diff --git a/generated_samples/autonomous_database_change_disaster_recovery_configuration.py b/generated_samples/autonomous_database_change_disaster_recovery_configuration.py new file mode 100644 index 000000000000..7851a587a24a --- /dev/null +++ b/generated_samples/autonomous_database_change_disaster_recovery_configuration.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) Python 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_change_disaster_recovery_configuration.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.autonomous_databases.begin_change_disaster_recovery_configuration( + resource_group_name='rg000', + autonomousdatabasename='databasedb1', + body={'disasterRecoveryType': 'Adg', 'isReplicateAutomaticBackups': False}, + ).result() + print(response) + +# x-ms-original-file: 2025-03-01/autonomousDatabase_changeDisasterRecoveryConfiguration.json +if __name__ == "__main__": + main() diff --git a/generated_samples/autonomous_database_failover.py b/generated_samples/autonomous_database_failover.py new file mode 100644 index 000000000000..b041f22d2046 --- /dev/null +++ b/generated_samples/autonomous_database_failover.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) Python 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_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="SUBSCRIPTION_ID", + ) + + response = client.autonomous_databases.begin_failover( + resource_group_name='rg000', + autonomousdatabasename='databasedb1', + body={'peerDbId': 'peerDbId'}, + ).result() + print(response) + +# x-ms-original-file: 2025-03-01/autonomousDatabase_failover.json +if __name__ == "__main__": + main() diff --git a/generated_samples/autonomous_database_generate_wallet.py b/generated_samples/autonomous_database_generate_wallet.py new file mode 100644 index 000000000000..c96687d509a6 --- /dev/null +++ b/generated_samples/autonomous_database_generate_wallet.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) Python 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_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="SUBSCRIPTION_ID", + ) + + response = client.autonomous_databases.generate_wallet( + resource_group_name='rg000', + autonomousdatabasename='databasedb1', + body={'generateType': 'Single', 'isRegional': False, 'password': '********'}, + ) + print(response) + +# x-ms-original-file: 2025-03-01/autonomousDatabase_generateWallet.json +if __name__ == "__main__": + main() diff --git a/generated_samples/autonomous_database_restore.py b/generated_samples/autonomous_database_restore.py new file mode 100644 index 000000000000..dacddda4b659 --- /dev/null +++ b/generated_samples/autonomous_database_restore.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) Python 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_restore.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.autonomous_databases.begin_restore( + resource_group_name='rg000', + autonomousdatabasename='databasedb1', + body={'timestamp': '2024-04-23T00:00:00.000Z'}, + ).result() + print(response) + +# x-ms-original-file: 2025-03-01/autonomousDatabase_restore.json +if __name__ == "__main__": + main() diff --git a/generated_samples/autonomous_database_switchover.py b/generated_samples/autonomous_database_switchover.py new file mode 100644 index 000000000000..b797ad85b618 --- /dev/null +++ b/generated_samples/autonomous_database_switchover.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) Python 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_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="SUBSCRIPTION_ID", + ) + + response = client.autonomous_databases.begin_switchover( + resource_group_name='rg000', + autonomousdatabasename='databasedb1', + body={'peerDbId': 'peerDbId'}, + ).result() + print(response) + +# x-ms-original-file: 2025-03-01/autonomousDatabase_switchover.json +if __name__ == "__main__": + main() diff --git a/generated_samples/db_nodes_action.py b/generated_samples/db_nodes_action.py new file mode 100644 index 000000000000..ec0531a4792b --- /dev/null +++ b/generated_samples/db_nodes_action.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) Python 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_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="SUBSCRIPTION_ID", + ) + + 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: 2025-03-01/dbNodes_action.json +if __name__ == "__main__": + main() diff --git a/generated_samples/db_system_shapes_list_by_location.py b/generated_samples/db_system_shapes_list_by_location.py new file mode 100644 index 000000000000..ab5887b601ce --- /dev/null +++ b/generated_samples/db_system_shapes_list_by_location.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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.db_system_shapes.list_by_location( + location='eastus', + ) + for item in response: + print(item) + +# x-ms-original-file: 2025-03-01/dbSystemShapes_listByLocation.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exa_infra_add_storage_capacity.py b/generated_samples/exa_infra_add_storage_capacity.py new file mode 100644 index 000000000000..e76c165a5189 --- /dev/null +++ b/generated_samples/exa_infra_add_storage_capacity.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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.cloud_exadata_infrastructures.begin_add_storage_capacity( + resource_group_name='rg000', + cloudexadatainfrastructurename='infra1', + ).result() + print(response) + +# x-ms-original-file: 2025-03-01/exaInfra_addStorageCapacity.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exadb_vm_clusters_remove_vms_maximum_set_gen.py b/generated_samples/exadb_vm_clusters_remove_vms_maximum_set_gen.py new file mode 100644 index 000000000000..7a6ac9e173cd --- /dev/null +++ b/generated_samples/exadb_vm_clusters_remove_vms_maximum_set_gen.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) Python 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 exadb_vm_clusters_remove_vms_maximum_set_gen.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.exadb_vm_clusters.begin_remove_vms( + resource_group_name='rgopenapi', + exadb_vm_cluster_name='vmClusterName', + body={'dbNodes': [{'dbNodeId': '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Oracle.Database/exadbVmClusters/vmCluster/dbNodes/dbNodeName'}]}, + ).result() + print(response) + +# x-ms-original-file: 2025-03-01/ExadbVmClusters_RemoveVms_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exascale_db_nodes_action_maximum_set_gen.py b/generated_samples/exascale_db_nodes_action_maximum_set_gen.py new file mode 100644 index 000000000000..7f8a2544fb92 --- /dev/null +++ b/generated_samples/exascale_db_nodes_action_maximum_set_gen.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) Python 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 exascale_db_nodes_action_maximum_set_gen.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.exascale_db_nodes.begin_action( + resource_group_name='rgopenapi', + exadb_vm_cluster_name='vmClusterName', + exascale_db_node_name='dbNodeName', + body={'action': 'Start'}, + ).result() + print(response) + +# x-ms-original-file: 2025-03-01/ExascaleDbNodes_Action_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exascale_db_nodes_list_by_parent_maximum_set_gen.py b/generated_samples/exascale_db_nodes_list_by_parent_maximum_set_gen.py new file mode 100644 index 000000000000..700cddfbb9fe --- /dev/null +++ b/generated_samples/exascale_db_nodes_list_by_parent_maximum_set_gen.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) Python 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 exascale_db_nodes_list_by_parent_maximum_set_gen.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.exascale_db_nodes.list_by_parent( + resource_group_name='rgopenapi', + exadb_vm_cluster_name='vmClusterName', + ) + for item in response: + print(item) + +# x-ms-original-file: 2025-03-01/ExascaleDbNodes_ListByParent_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exascale_db_storage_vaults_create_maximum_set_gen.py b/generated_samples/exascale_db_storage_vaults_create_maximum_set_gen.py new file mode 100644 index 000000000000..e7449b30e86c --- /dev/null +++ b/generated_samples/exascale_db_storage_vaults_create_maximum_set_gen.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) Python 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 exascale_db_storage_vaults_create_maximum_set_gen.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.exascale_db_storage_vaults.begin_create( + resource_group_name='rgopenapi', + exascale_db_storage_vault_name='vmClusterName', + resource={'location': 'ltguhzffucaytqg', 'properties': {'additionalFlashCacheInPercent': 0, 'description': 'dmnvnnduldfmrmkkvvsdtuvmsmruxzzpsfdydgytlckutfozephjygjetrauvbdfcwmti', 'displayName': 'hbsybtelyvhpalemszcvartlhwvskrnpiveqfblvkdihoytqaotdgsgauvgivzaftfgeiwlyeqzssicwrrnlxtsmeakbcsxabjlt', 'highCapacityDatabaseStorage': {'availableSizeInGbs': 28, 'totalSizeInGbs': 16}, 'highCapacityDatabaseStorageInput': {'totalSizeInGbs': 21}, 'lifecycleState': 'Provisioning', 'ocid': 'ocid1.autonomousdatabase.oc1..aaaaa3klq', 'timeZone': 'ltrbozwxjunncicrtzjrpqnqrcjgghohztrdlbfjrbkpenopyldwolslwgrgumjfkyovvkzcuxjujuxtjjzubvqvnhrswnbdgcbslopeofmtepbrrlymqwwszvsglmyuvlcuejshtpokirwklnwpcykhyinjmlqvxtyixlthtdishhmtipbygsayvgqzfrprgppylydlcskbmvwctxifdltippfvsxiughqbojqpqrekxsotnqsk'}, 'tags': {'key7827': 'xqi'}, 'zones': ['qk']}, + ).result() + print(response) + +# x-ms-original-file: 2025-03-01/ExascaleDbStorageVaults_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exascale_db_storage_vaults_delete_maximum_set_gen.py b/generated_samples/exascale_db_storage_vaults_delete_maximum_set_gen.py new file mode 100644 index 000000000000..b21899c9d187 --- /dev/null +++ b/generated_samples/exascale_db_storage_vaults_delete_maximum_set_gen.py @@ -0,0 +1,37 @@ +# 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) Python 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 exascale_db_storage_vaults_delete_maximum_set_gen.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", + ) + + client.exascale_db_storage_vaults.begin_delete( + resource_group_name='rgopenapi', + exascale_db_storage_vault_name='vmClusterName', + ).result() + +# x-ms-original-file: 2025-03-01/ExascaleDbStorageVaults_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exascale_db_storage_vaults_get_maximum_set_gen.py b/generated_samples/exascale_db_storage_vaults_get_maximum_set_gen.py new file mode 100644 index 000000000000..783501979c25 --- /dev/null +++ b/generated_samples/exascale_db_storage_vaults_get_maximum_set_gen.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) Python 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 exascale_db_storage_vaults_get_maximum_set_gen.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.exascale_db_storage_vaults.get( + resource_group_name='rgopenapi', + exascale_db_storage_vault_name='vmClusterName', + ) + print(response) + +# x-ms-original-file: 2025-03-01/ExascaleDbStorageVaults_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exascale_db_storage_vaults_list_by_resource_group_maximum_set_gen.py b/generated_samples/exascale_db_storage_vaults_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..689c571219f3 --- /dev/null +++ b/generated_samples/exascale_db_storage_vaults_list_by_resource_group_maximum_set_gen.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) Python 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 exascale_db_storage_vaults_list_by_resource_group_maximum_set_gen.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.exascale_db_storage_vaults.list_by_resource_group( + resource_group_name='rgopenapi', + ) + for item in response: + print(item) + +# x-ms-original-file: 2025-03-01/ExascaleDbStorageVaults_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exascale_db_storage_vaults_list_by_subscription_maximum_set_gen.py b/generated_samples/exascale_db_storage_vaults_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..3628b8fe4e01 --- /dev/null +++ b/generated_samples/exascale_db_storage_vaults_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,37 @@ +# 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) Python 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 exascale_db_storage_vaults_list_by_subscription_maximum_set_gen.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.exascale_db_storage_vaults.list_by_subscription( + ) + for item in response: + print(item) + +# x-ms-original-file: 2025-03-01/ExascaleDbStorageVaults_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/exascale_db_storage_vaults_update_maximum_set_gen.py b/generated_samples/exascale_db_storage_vaults_update_maximum_set_gen.py new file mode 100644 index 000000000000..9ae65ad7f227 --- /dev/null +++ b/generated_samples/exascale_db_storage_vaults_update_maximum_set_gen.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) Python 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 exascale_db_storage_vaults_update_maximum_set_gen.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.exascale_db_storage_vaults.begin_update( + resource_group_name='rgopenapi', + exascale_db_storage_vault_name='vmClusterName', + properties={'tags': {'key6179': 'ouj'}}, + ).result() + print(response) + +# x-ms-original-file: 2025-03-01/ExascaleDbStorageVaults_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/flex_components_get_maximum_set_gen.py b/generated_samples/flex_components_get_maximum_set_gen.py new file mode 100644 index 000000000000..1dcdc6c10105 --- /dev/null +++ b/generated_samples/flex_components_get_maximum_set_gen.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) Python 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 flex_components_get_maximum_set_gen.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.flex_components.get( + location='eastus', + flex_component_name='flexComponent', + ) + print(response) + +# x-ms-original-file: 2025-03-01/FlexComponents_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/flex_components_list_by_parent_maximum_set_gen.py b/generated_samples/flex_components_list_by_parent_maximum_set_gen.py new file mode 100644 index 000000000000..c93e01fca0e9 --- /dev/null +++ b/generated_samples/flex_components_list_by_parent_maximum_set_gen.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) Python 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 flex_components_list_by_parent_maximum_set_gen.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.flex_components.list_by_parent( + location='eastus', + ) + for item in response: + print(item) + +# x-ms-original-file: 2025-03-01/FlexComponents_ListByParent_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/gi_minor_versions_get_maximum_set_gen.py b/generated_samples/gi_minor_versions_get_maximum_set_gen.py new file mode 100644 index 000000000000..221983f1c83c --- /dev/null +++ b/generated_samples/gi_minor_versions_get_maximum_set_gen.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) Python 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_minor_versions_get_maximum_set_gen.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.gi_minor_versions.get( + location='eastus', + giversionname='giVersionName', + gi_minor_version_name='giMinorVersionName', + ) + print(response) + +# x-ms-original-file: 2025-03-01/GiMinorVersions_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/gi_minor_versions_list_by_parent_maximum_set_gen.py b/generated_samples/gi_minor_versions_list_by_parent_maximum_set_gen.py new file mode 100644 index 000000000000..a58fde0cd888 --- /dev/null +++ b/generated_samples/gi_minor_versions_list_by_parent_maximum_set_gen.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) Python 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_minor_versions_list_by_parent_maximum_set_gen.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.gi_minor_versions.list_by_parent( + location='eastus', + giversionname='giVersionName', + ) + for item in response: + print(item) + +# x-ms-original-file: 2025-03-01/GiMinorVersions_ListByParent_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/gi_versions_list_by_location_maximum_set_gen.py b/generated_samples/gi_versions_list_by_location_maximum_set_gen.py new file mode 100644 index 000000000000..5add9143ef35 --- /dev/null +++ b/generated_samples/gi_versions_list_by_location_maximum_set_gen.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) Python 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_maximum_set_gen.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.gi_versions.list_by_location( + location='eastus', + ) + for item in response: + print(item) + +# x-ms-original-file: 2025-03-01/GiVersions_ListByLocation_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/gi_versions_list_by_location_minimum_set_gen.py b/generated_samples/gi_versions_list_by_location_minimum_set_gen.py new file mode 100644 index 000000000000..e3ab0d2c7e8b --- /dev/null +++ b/generated_samples/gi_versions_list_by_location_minimum_set_gen.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) Python 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_minimum_set_gen.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.gi_versions.list_by_location( + location='eastus', + ) + for item in response: + print(item) + +# x-ms-original-file: 2025-03-01/GiVersions_ListByLocation_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/generated_samples/operations_list.py b/generated_samples/operations_list.py new file mode 100644 index 000000000000..3523db593c56 --- /dev/null +++ b/generated_samples/operations_list.py @@ -0,0 +1,37 @@ +# 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) Python 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: 2025-03-01/operations_list.json +if __name__ == "__main__": + main() diff --git a/generated_samples/oracle_subscriptions_add_azure_subscriptions.py b/generated_samples/oracle_subscriptions_add_azure_subscriptions.py new file mode 100644 index 000000000000..0a9044e2faf3 --- /dev/null +++ b/generated_samples/oracle_subscriptions_add_azure_subscriptions.py @@ -0,0 +1,36 @@ +# 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) Python 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_add_azure_subscriptions.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", + ) + + client.oracle_subscriptions.begin_add_azure_subscriptions( + body={'azureSubscriptionIds': ['00000000-0000-0000-0000-000000000001']}, + ).result() + +# x-ms-original-file: 2025-03-01/oracleSubscriptions_addAzureSubscriptions.json +if __name__ == "__main__": + main() diff --git a/generated_samples/oracle_subscriptions_list_activation_links.py b/generated_samples/oracle_subscriptions_list_activation_links.py new file mode 100644 index 000000000000..7d4c09a43690 --- /dev/null +++ b/generated_samples/oracle_subscriptions_list_activation_links.py @@ -0,0 +1,35 @@ +# 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) Python 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="SUBSCRIPTION_ID", + ) + + client.oracle_subscriptions.begin_list_activation_links( + ).result() + +# x-ms-original-file: 2025-03-01/oracleSubscriptions_listActivationLinks.json +if __name__ == "__main__": + main() diff --git a/generated_samples/oracle_subscriptions_list_cloud_account_details.py b/generated_samples/oracle_subscriptions_list_cloud_account_details.py new file mode 100644 index 000000000000..8e7c92e0cf44 --- /dev/null +++ b/generated_samples/oracle_subscriptions_list_cloud_account_details.py @@ -0,0 +1,35 @@ +# 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) Python 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="SUBSCRIPTION_ID", + ) + + client.oracle_subscriptions.begin_list_cloud_account_details( + ).result() + +# x-ms-original-file: 2025-03-01/oracleSubscriptions_listCloudAccountDetails.json +if __name__ == "__main__": + main() diff --git a/generated_samples/oracle_subscriptions_list_saas_subscription_details.py b/generated_samples/oracle_subscriptions_list_saas_subscription_details.py new file mode 100644 index 000000000000..a9fba65c3fad --- /dev/null +++ b/generated_samples/oracle_subscriptions_list_saas_subscription_details.py @@ -0,0 +1,35 @@ +# 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) Python 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="SUBSCRIPTION_ID", + ) + + client.oracle_subscriptions.begin_list_saas_subscription_details( + ).result() + +# x-ms-original-file: 2025-03-01/oracleSubscriptions_listSaasSubscriptionDetails.json +if __name__ == "__main__": + main() diff --git a/generated_samples/vm_clusters_add_vms.py b/generated_samples/vm_clusters_add_vms.py new file mode 100644 index 000000000000..9422e0a7ac1d --- /dev/null +++ b/generated_samples/vm_clusters_add_vms.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) Python 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_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="SUBSCRIPTION_ID", + ) + + 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: 2025-03-01/vmClusters_addVms.json +if __name__ == "__main__": + main() diff --git a/generated_samples/vm_clusters_list_private_ip_addresses.py b/generated_samples/vm_clusters_list_private_ip_addresses.py new file mode 100644 index 000000000000..db4fb4285259 --- /dev/null +++ b/generated_samples/vm_clusters_list_private_ip_addresses.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) Python 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_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="SUBSCRIPTION_ID", + ) + + 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: 2025-03-01/vmClusters_listPrivateIpAddresses.json +if __name__ == "__main__": + main() diff --git a/generated_samples/vm_clusters_remove_vms.py b/generated_samples/vm_clusters_remove_vms.py new file mode 100644 index 000000000000..1e6e68ca9066 --- /dev/null +++ b/generated_samples/vm_clusters_remove_vms.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) Python 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_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="SUBSCRIPTION_ID", + ) + + 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: 2025-03-01/vmClusters_removeVms.json +if __name__ == "__main__": + main() diff --git a/generated_tests/conftest.py b/generated_tests/conftest.py new file mode 100644 index 000000000000..950510b1fb0b --- /dev/null +++ b/generated_tests/conftest.py @@ -0,0 +1,29 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import test_proxy, add_general_regex_sanitizer, add_body_key_sanitizer, add_header_regex_sanitizer + +load_dotenv() + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + oracledatabasemgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + oracledatabasemgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + oracledatabasemgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + oracledatabasemgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=oracledatabasemgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=oracledatabasemgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=oracledatabasemgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=oracledatabasemgmt_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") diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_database_backups_operations.py b/generated_tests/test_oracle_database_mgmt_autonomous_database_backups_operations.py new file mode 100644 index 000000000000..eedfabcd9a17 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_database_backups_operations.py @@ -0,0 +1,150 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabaseBackupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_backups_begin_create_or_update(self, resource_group): + response = self.client.autonomous_database_backups.begin_create_or_update( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + adbbackupid="str" +, + resource={ + "id": "str", + "name": "str", + "properties": { + "autonomousDatabaseOcid": "str", + "backupType": "str", + "databaseSizeInTbs": 0.0, + "dbVersion": "str", + "displayName": "str", + "isAutomatic": bool, + "isRestorable": bool, + "lifecycleDetails": "str", + "lifecycleState": "str", + "ocid": "str", + "provisioningState": "str", + "retentionPeriodInDays": 0, + "sizeInTbs": 0.0, + "timeAvailableTil": "2020-02-20 00:00:00", + "timeEnded": "str", + "timeStarted": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_backups_get(self, resource_group): + response = self.client.autonomous_database_backups.get( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + adbbackupid="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_backups_begin_delete(self, resource_group): + response = self.client.autonomous_database_backups.begin_delete( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + adbbackupid="str" +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_backups_begin_update(self, resource_group): + response = self.client.autonomous_database_backups.begin_update( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + adbbackupid="str" +, + properties={ + "id": "str", + "name": "str", + "properties": { + "autonomousDatabaseOcid": "str", + "backupType": "str", + "databaseSizeInTbs": 0.0, + "dbVersion": "str", + "displayName": "str", + "isAutomatic": bool, + "isRestorable": bool, + "lifecycleDetails": "str", + "lifecycleState": "str", + "ocid": "str", + "provisioningState": "str", + "retentionPeriodInDays": 0, + "sizeInTbs": 0.0, + "timeAvailableTil": "2020-02-20 00:00:00", + "timeEnded": "str", + "timeStarted": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_backups_list_by_parent(self, resource_group): + response = self.client.autonomous_database_backups.list_by_parent( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_database_backups_operations_async.py b/generated_tests/test_oracle_database_mgmt_autonomous_database_backups_operations_async.py new file mode 100644 index 000000000000..2a3210fcc67c --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_database_backups_operations_async.py @@ -0,0 +1,151 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabaseBackupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_backups_begin_create_or_update(self, resource_group): + response = await (await self.client.autonomous_database_backups.begin_create_or_update( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + adbbackupid="str" +, + resource={ + "id": "str", + "name": "str", + "properties": { + "autonomousDatabaseOcid": "str", + "backupType": "str", + "databaseSizeInTbs": 0.0, + "dbVersion": "str", + "displayName": "str", + "isAutomatic": bool, + "isRestorable": bool, + "lifecycleDetails": "str", + "lifecycleState": "str", + "ocid": "str", + "provisioningState": "str", + "retentionPeriodInDays": 0, + "sizeInTbs": 0.0, + "timeAvailableTil": "2020-02-20 00:00:00", + "timeEnded": "str", + "timeStarted": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_backups_get(self, resource_group): + response = await self.client.autonomous_database_backups.get( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + adbbackupid="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_backups_begin_delete(self, resource_group): + response = await (await self.client.autonomous_database_backups.begin_delete( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + adbbackupid="str" +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_backups_begin_update(self, resource_group): + response = await (await self.client.autonomous_database_backups.begin_update( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + adbbackupid="str" +, + properties={ + "id": "str", + "name": "str", + "properties": { + "autonomousDatabaseOcid": "str", + "backupType": "str", + "databaseSizeInTbs": 0.0, + "dbVersion": "str", + "displayName": "str", + "isAutomatic": bool, + "isRestorable": bool, + "lifecycleDetails": "str", + "lifecycleState": "str", + "ocid": "str", + "provisioningState": "str", + "retentionPeriodInDays": 0, + "sizeInTbs": 0.0, + "timeAvailableTil": "2020-02-20 00:00:00", + "timeEnded": "str", + "timeStarted": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_backups_list_by_parent(self, resource_group): + response = self.client.autonomous_database_backups.list_by_parent( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_database_character_sets_operations.py b/generated_tests/test_oracle_database_mgmt_autonomous_database_character_sets_operations.py new file mode 100644 index 000000000000..a7eb82471d57 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_database_character_sets_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabaseCharacterSetsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_character_sets_get(self, resource_group): + response = self.client.autonomous_database_character_sets.get( + location="str" +, + adbscharsetname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_character_sets_list_by_location(self, resource_group): + response = self.client.autonomous_database_character_sets.list_by_location( + location="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_database_character_sets_operations_async.py b/generated_tests/test_oracle_database_mgmt_autonomous_database_character_sets_operations_async.py new file mode 100644 index 000000000000..ab7af16b852f --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_database_character_sets_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabaseCharacterSetsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_character_sets_get(self, resource_group): + response = await self.client.autonomous_database_character_sets.get( + location="str" +, + adbscharsetname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_character_sets_list_by_location(self, resource_group): + response = self.client.autonomous_database_character_sets.list_by_location( + location="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_database_national_character_sets_operations.py b/generated_tests/test_oracle_database_mgmt_autonomous_database_national_character_sets_operations.py new file mode 100644 index 000000000000..bdb9a942e2fb --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_database_national_character_sets_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabaseNationalCharacterSetsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_national_character_sets_get(self, resource_group): + response = self.client.autonomous_database_national_character_sets.get( + location="str" +, + adbsncharsetname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_national_character_sets_list_by_location(self, resource_group): + response = self.client.autonomous_database_national_character_sets.list_by_location( + location="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_database_national_character_sets_operations_async.py b/generated_tests/test_oracle_database_mgmt_autonomous_database_national_character_sets_operations_async.py new file mode 100644 index 000000000000..b3bcb5a28b0f --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_database_national_character_sets_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabaseNationalCharacterSetsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_national_character_sets_get(self, resource_group): + response = await self.client.autonomous_database_national_character_sets.get( + location="str" +, + adbsncharsetname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_national_character_sets_list_by_location(self, resource_group): + response = self.client.autonomous_database_national_character_sets.list_by_location( + location="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_database_versions_operations.py b/generated_tests/test_oracle_database_mgmt_autonomous_database_versions_operations.py new file mode 100644 index 000000000000..f8f8686e5ccf --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_database_versions_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabaseVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_versions_get(self, resource_group): + response = self.client.autonomous_database_versions.get( + location="str" +, + autonomousdbversionsname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_database_versions_list_by_location(self, resource_group): + response = self.client.autonomous_database_versions.list_by_location( + location="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_database_versions_operations_async.py b/generated_tests/test_oracle_database_mgmt_autonomous_database_versions_operations_async.py new file mode 100644 index 000000000000..316ad3d6e7ca --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_database_versions_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabaseVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_versions_get(self, resource_group): + response = await self.client.autonomous_database_versions.get( + location="str" +, + autonomousdbversionsname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_database_versions_list_by_location(self, resource_group): + response = self.client.autonomous_database_versions.list_by_location( + location="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_databases_operations.py b/generated_tests/test_oracle_database_mgmt_autonomous_databases_operations.py new file mode 100644 index 000000000000..31806276a23e --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_databases_operations.py @@ -0,0 +1,253 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabasesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_list_by_subscription(self, resource_group): + response = self.client.autonomous_databases.list_by_subscription( + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_begin_create_or_update(self, resource_group): + response = self.client.autonomous_databases.begin_create_or_update( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": "autonomous_database_base_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_get(self, resource_group): + response = self.client.autonomous_databases.get( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_begin_update(self, resource_group): + response = self.client.autonomous_databases.begin_update( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + properties={ + "properties": { + "adminPassword": "str", + "autonomousMaintenanceScheduleType": "str", + "backupRetentionPeriodInDays": 0, + "computeCount": 0.0, + "cpuCoreCount": 0, + "customerContacts": [ + { + "email": "str" + } + ], + "dataStorageSizeInGbs": 0, + "dataStorageSizeInTbs": 0, + "databaseEdition": "str", + "displayName": "str", + "isAutoScalingEnabled": bool, + "isAutoScalingForStorageEnabled": bool, + "isLocalDataGuardEnabled": bool, + "isMtlsConnectionRequired": bool, + "licenseModel": "str", + "localAdgAutoFailoverMaxDataLossLimit": 0, + "longTermBackupSchedule": { + "isDisabled": bool, + "repeatCadence": "str", + "retentionPeriodInDays": 0, + "timeOfBackup": "2020-02-20 00:00:00" + }, + "openMode": "str", + "peerDbId": "str", + "permissionLevel": "str", + "role": "str", + "scheduledOperations": { + "dayOfWeek": { + "name": "str" + }, + "scheduledStartTime": "str", + "scheduledStopTime": "str" + }, + "whitelistedIps": [ + "str" + ] + }, + "tags": { + "str": "str" + } + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_begin_delete(self, resource_group): + response = self.client.autonomous_databases.begin_delete( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_list_by_resource_group(self, resource_group): + response = self.client.autonomous_databases.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_begin_switchover(self, resource_group): + response = self.client.autonomous_databases.begin_switchover( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "peerDbId": "str", + "peerDbLocation": "str", + "peerDbOcid": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_begin_failover(self, resource_group): + response = self.client.autonomous_databases.begin_failover( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "peerDbId": "str", + "peerDbLocation": "str", + "peerDbOcid": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_generate_wallet(self, resource_group): + response = self.client.autonomous_databases.generate_wallet( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "password": "str", + "generateType": "str", + "isRegional": bool + } +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_begin_restore(self, resource_group): + response = self.client.autonomous_databases.begin_restore( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "timestamp": "2020-02-20 00:00:00" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_begin_shrink(self, resource_group): + response = self.client.autonomous_databases.begin_shrink( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_autonomous_databases_begin_change_disaster_recovery_configuration(self, resource_group): + response = self.client.autonomous_databases.begin_change_disaster_recovery_configuration( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "disasterRecoveryType": "str", + "isReplicateAutomaticBackups": bool, + "isSnapshotStandby": bool, + "timeSnapshotStandbyEnabledTill": "2020-02-20 00:00:00" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_autonomous_databases_operations_async.py b/generated_tests/test_oracle_database_mgmt_autonomous_databases_operations_async.py new file mode 100644 index 000000000000..470844bf3849 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_autonomous_databases_operations_async.py @@ -0,0 +1,254 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtAutonomousDatabasesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_list_by_subscription(self, resource_group): + response = self.client.autonomous_databases.list_by_subscription( + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_begin_create_or_update(self, resource_group): + response = await (await self.client.autonomous_databases.begin_create_or_update( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": "autonomous_database_base_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_get(self, resource_group): + response = await self.client.autonomous_databases.get( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_begin_update(self, resource_group): + response = await (await self.client.autonomous_databases.begin_update( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + properties={ + "properties": { + "adminPassword": "str", + "autonomousMaintenanceScheduleType": "str", + "backupRetentionPeriodInDays": 0, + "computeCount": 0.0, + "cpuCoreCount": 0, + "customerContacts": [ + { + "email": "str" + } + ], + "dataStorageSizeInGbs": 0, + "dataStorageSizeInTbs": 0, + "databaseEdition": "str", + "displayName": "str", + "isAutoScalingEnabled": bool, + "isAutoScalingForStorageEnabled": bool, + "isLocalDataGuardEnabled": bool, + "isMtlsConnectionRequired": bool, + "licenseModel": "str", + "localAdgAutoFailoverMaxDataLossLimit": 0, + "longTermBackupSchedule": { + "isDisabled": bool, + "repeatCadence": "str", + "retentionPeriodInDays": 0, + "timeOfBackup": "2020-02-20 00:00:00" + }, + "openMode": "str", + "peerDbId": "str", + "permissionLevel": "str", + "role": "str", + "scheduledOperations": { + "dayOfWeek": { + "name": "str" + }, + "scheduledStartTime": "str", + "scheduledStopTime": "str" + }, + "whitelistedIps": [ + "str" + ] + }, + "tags": { + "str": "str" + } + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_begin_delete(self, resource_group): + response = await (await self.client.autonomous_databases.begin_delete( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_list_by_resource_group(self, resource_group): + response = self.client.autonomous_databases.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_begin_switchover(self, resource_group): + response = await (await self.client.autonomous_databases.begin_switchover( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "peerDbId": "str", + "peerDbLocation": "str", + "peerDbOcid": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_begin_failover(self, resource_group): + response = await (await self.client.autonomous_databases.begin_failover( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "peerDbId": "str", + "peerDbLocation": "str", + "peerDbOcid": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_generate_wallet(self, resource_group): + response = await self.client.autonomous_databases.generate_wallet( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "password": "str", + "generateType": "str", + "isRegional": bool + } +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_begin_restore(self, resource_group): + response = await (await self.client.autonomous_databases.begin_restore( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "timestamp": "2020-02-20 00:00:00" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_begin_shrink(self, resource_group): + response = await (await self.client.autonomous_databases.begin_shrink( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_autonomous_databases_begin_change_disaster_recovery_configuration(self, resource_group): + response = await (await self.client.autonomous_databases.begin_change_disaster_recovery_configuration( + resource_group_name=resource_group.name, + autonomousdatabasename="str" +, + body={ + "disasterRecoveryType": "str", + "isReplicateAutomaticBackups": bool, + "isSnapshotStandby": bool, + "timeSnapshotStandbyEnabledTill": "2020-02-20 00:00:00" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_cloud_exadata_infrastructures_operations.py b/generated_tests/test_oracle_database_mgmt_cloud_exadata_infrastructures_operations.py new file mode 100644 index 000000000000..4e2eb0ce3766 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_cloud_exadata_infrastructures_operations.py @@ -0,0 +1,237 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtCloudExadataInfrastructuresOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_exadata_infrastructures_list_by_subscription(self, resource_group): + response = self.client.cloud_exadata_infrastructures.list_by_subscription( + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_exadata_infrastructures_begin_create_or_update(self, resource_group): + response = self.client.cloud_exadata_infrastructures.begin_create_or_update( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + resource={ + "location": "str", + "zones": [ + "str" + ], + "id": "str", + "name": "str", + "properties": { + "displayName": "str", + "shape": "str", + "activatedStorageCount": 0, + "additionalStorageCount": 0, + "availableStorageSizeInGbs": 0, + "computeCount": 0, + "computeModel": "str", + "cpuCount": 0, + "customerContacts": [ + { + "email": "str" + } + ], + "dataStorageSizeInTbs": 0.0, + "databaseServerType": "str", + "dbNodeStorageSizeInGbs": 0, + "dbServerVersion": "str", + "definedFileSystemConfiguration": [ + { + "isBackupPartition": bool, + "isResizable": bool, + "minSizeGb": 0, + "mountPoint": "str" + } + ], + "estimatedPatchingTime": { + "estimatedDbServerPatchingTime": 0, + "estimatedNetworkSwitchesPatchingTime": 0, + "estimatedStorageServerPatchingTime": 0, + "totalEstimatedPatchingTime": 0 + }, + "lastMaintenanceRunId": "str", + "lifecycleDetails": "str", + "lifecycleState": "str", + "maintenanceWindow": { + "customActionTimeoutInMins": 0, + "daysOfWeek": [ + { + "name": "str" + } + ], + "hoursOfDay": [ + 0 + ], + "isCustomActionTimeoutEnabled": bool, + "isMonthlyPatchingEnabled": bool, + "leadTimeInWeeks": 0, + "months": [ + { + "name": "str" + } + ], + "patchingMode": "str", + "preference": "str", + "weeksOfMonth": [ + 0 + ] + }, + "maxCpuCount": 0, + "maxDataStorageInTbs": 0.0, + "maxDbNodeStorageSizeInGbs": 0, + "maxMemoryInGbs": 0, + "memorySizeInGbs": 0, + "monthlyDbServerVersion": "str", + "monthlyStorageServerVersion": "str", + "nextMaintenanceRunId": "str", + "ociUrl": "str", + "ocid": "str", + "provisioningState": "str", + "storageCount": 0, + "storageServerType": "str", + "storageServerVersion": "str", + "timeCreated": "str", + "totalStorageSizeInGbs": 0 + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_exadata_infrastructures_get(self, resource_group): + response = self.client.cloud_exadata_infrastructures.get( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_exadata_infrastructures_begin_update(self, resource_group): + response = self.client.cloud_exadata_infrastructures.begin_update( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + properties={ + "properties": { + "computeCount": 0, + "customerContacts": [ + { + "email": "str" + } + ], + "displayName": "str", + "maintenanceWindow": { + "customActionTimeoutInMins": 0, + "daysOfWeek": [ + { + "name": "str" + } + ], + "hoursOfDay": [ + 0 + ], + "isCustomActionTimeoutEnabled": bool, + "isMonthlyPatchingEnabled": bool, + "leadTimeInWeeks": 0, + "months": [ + { + "name": "str" + } + ], + "patchingMode": "str", + "preference": "str", + "weeksOfMonth": [ + 0 + ] + }, + "storageCount": 0 + }, + "tags": { + "str": "str" + }, + "zones": [ + "str" + ] + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_exadata_infrastructures_begin_delete(self, resource_group): + response = self.client.cloud_exadata_infrastructures.begin_delete( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_exadata_infrastructures_list_by_resource_group(self, resource_group): + response = self.client.cloud_exadata_infrastructures.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_exadata_infrastructures_begin_add_storage_capacity(self, resource_group): + response = self.client.cloud_exadata_infrastructures.begin_add_storage_capacity( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_cloud_exadata_infrastructures_operations_async.py b/generated_tests/test_oracle_database_mgmt_cloud_exadata_infrastructures_operations_async.py new file mode 100644 index 000000000000..4449d8b21d25 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_cloud_exadata_infrastructures_operations_async.py @@ -0,0 +1,238 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtCloudExadataInfrastructuresOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_exadata_infrastructures_list_by_subscription(self, resource_group): + response = self.client.cloud_exadata_infrastructures.list_by_subscription( + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_exadata_infrastructures_begin_create_or_update(self, resource_group): + response = await (await self.client.cloud_exadata_infrastructures.begin_create_or_update( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + resource={ + "location": "str", + "zones": [ + "str" + ], + "id": "str", + "name": "str", + "properties": { + "displayName": "str", + "shape": "str", + "activatedStorageCount": 0, + "additionalStorageCount": 0, + "availableStorageSizeInGbs": 0, + "computeCount": 0, + "computeModel": "str", + "cpuCount": 0, + "customerContacts": [ + { + "email": "str" + } + ], + "dataStorageSizeInTbs": 0.0, + "databaseServerType": "str", + "dbNodeStorageSizeInGbs": 0, + "dbServerVersion": "str", + "definedFileSystemConfiguration": [ + { + "isBackupPartition": bool, + "isResizable": bool, + "minSizeGb": 0, + "mountPoint": "str" + } + ], + "estimatedPatchingTime": { + "estimatedDbServerPatchingTime": 0, + "estimatedNetworkSwitchesPatchingTime": 0, + "estimatedStorageServerPatchingTime": 0, + "totalEstimatedPatchingTime": 0 + }, + "lastMaintenanceRunId": "str", + "lifecycleDetails": "str", + "lifecycleState": "str", + "maintenanceWindow": { + "customActionTimeoutInMins": 0, + "daysOfWeek": [ + { + "name": "str" + } + ], + "hoursOfDay": [ + 0 + ], + "isCustomActionTimeoutEnabled": bool, + "isMonthlyPatchingEnabled": bool, + "leadTimeInWeeks": 0, + "months": [ + { + "name": "str" + } + ], + "patchingMode": "str", + "preference": "str", + "weeksOfMonth": [ + 0 + ] + }, + "maxCpuCount": 0, + "maxDataStorageInTbs": 0.0, + "maxDbNodeStorageSizeInGbs": 0, + "maxMemoryInGbs": 0, + "memorySizeInGbs": 0, + "monthlyDbServerVersion": "str", + "monthlyStorageServerVersion": "str", + "nextMaintenanceRunId": "str", + "ociUrl": "str", + "ocid": "str", + "provisioningState": "str", + "storageCount": 0, + "storageServerType": "str", + "storageServerVersion": "str", + "timeCreated": "str", + "totalStorageSizeInGbs": 0 + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_exadata_infrastructures_get(self, resource_group): + response = await self.client.cloud_exadata_infrastructures.get( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_exadata_infrastructures_begin_update(self, resource_group): + response = await (await self.client.cloud_exadata_infrastructures.begin_update( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + properties={ + "properties": { + "computeCount": 0, + "customerContacts": [ + { + "email": "str" + } + ], + "displayName": "str", + "maintenanceWindow": { + "customActionTimeoutInMins": 0, + "daysOfWeek": [ + { + "name": "str" + } + ], + "hoursOfDay": [ + 0 + ], + "isCustomActionTimeoutEnabled": bool, + "isMonthlyPatchingEnabled": bool, + "leadTimeInWeeks": 0, + "months": [ + { + "name": "str" + } + ], + "patchingMode": "str", + "preference": "str", + "weeksOfMonth": [ + 0 + ] + }, + "storageCount": 0 + }, + "tags": { + "str": "str" + }, + "zones": [ + "str" + ] + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_exadata_infrastructures_begin_delete(self, resource_group): + response = await (await self.client.cloud_exadata_infrastructures.begin_delete( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_exadata_infrastructures_list_by_resource_group(self, resource_group): + response = self.client.cloud_exadata_infrastructures.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_exadata_infrastructures_begin_add_storage_capacity(self, resource_group): + response = await (await self.client.cloud_exadata_infrastructures.begin_add_storage_capacity( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_cloud_vm_clusters_operations.py b/generated_tests/test_oracle_database_mgmt_cloud_vm_clusters_operations.py new file mode 100644 index 000000000000..5a4ef53db808 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_cloud_vm_clusters_operations.py @@ -0,0 +1,279 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtCloudVmClustersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_vm_clusters_list_by_subscription(self, resource_group): + response = self.client.cloud_vm_clusters.list_by_subscription( + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_vm_clusters_begin_create_or_update(self, resource_group): + response = self.client.cloud_vm_clusters.begin_create_or_update( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "cloudExadataInfrastructureId": "str", + "cpuCoreCount": 0, + "displayName": "str", + "giVersion": "str", + "hostname": "str", + "sshPublicKeys": [ + "str" + ], + "subnetId": "str", + "vnetId": "str", + "backupSubnetCidr": "str", + "clusterName": "str", + "compartmentId": "str", + "computeModel": "str", + "computeNodes": [ + "str" + ], + "dataCollectionOptions": { + "isDiagnosticsEventsEnabled": bool, + "isHealthMonitoringEnabled": bool, + "isIncidentLogsEnabled": bool + }, + "dataStoragePercentage": 0, + "dataStorageSizeInTbs": 0.0, + "dbNodeStorageSizeInGbs": 0, + "dbServers": [ + "str" + ], + "diskRedundancy": "str", + "domain": "str", + "fileSystemConfigurationDetails": [ + { + "fileSystemSizeGb": 0, + "mountPoint": "str" + } + ], + "iormConfigCache": { + "dbPlans": [ + { + "dbName": "str", + "flashCacheLimit": "str", + "share": 0 + } + ], + "lifecycleDetails": "str", + "lifecycleState": "str", + "objective": "str" + }, + "isLocalBackupEnabled": bool, + "isSparseDiskgroupEnabled": bool, + "lastUpdateHistoryEntryId": "str", + "licenseModel": "str", + "lifecycleDetails": "str", + "lifecycleState": "str", + "listenerPort": 0, + "memorySizeInGbs": 0, + "nodeCount": 0, + "nsgCidrs": [ + { + "source": "str", + "destinationPortRange": { + "max": 0, + "min": 0 + } + } + ], + "nsgUrl": "str", + "ociUrl": "str", + "ocid": "str", + "ocpuCount": 0.0, + "provisioningState": "str", + "scanDnsName": "str", + "scanDnsRecordId": "str", + "scanIpIds": [ + "str" + ], + "scanListenerPortTcp": 0, + "scanListenerPortTcpSsl": 0, + "shape": "str", + "storageSizeInGbs": 0, + "subnetOcid": "str", + "systemVersion": "str", + "timeCreated": "2020-02-20 00:00:00", + "timeZone": "str", + "vipIds": [ + "str" + ], + "zoneId": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_vm_clusters_get(self, resource_group): + response = self.client.cloud_vm_clusters.get( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_vm_clusters_begin_update(self, resource_group): + response = self.client.cloud_vm_clusters.begin_update( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + properties={ + "properties": { + "computeNodes": [ + "str" + ], + "cpuCoreCount": 0, + "dataCollectionOptions": { + "isDiagnosticsEventsEnabled": bool, + "isHealthMonitoringEnabled": bool, + "isIncidentLogsEnabled": bool + }, + "dataStorageSizeInTbs": 0.0, + "dbNodeStorageSizeInGbs": 0, + "displayName": "str", + "fileSystemConfigurationDetails": [ + { + "fileSystemSizeGb": 0, + "mountPoint": "str" + } + ], + "licenseModel": "str", + "memorySizeInGbs": 0, + "ocpuCount": 0.0, + "sshPublicKeys": [ + "str" + ], + "storageSizeInGbs": 0 + }, + "tags": { + "str": "str" + } + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_vm_clusters_begin_delete(self, resource_group): + response = self.client.cloud_vm_clusters.begin_delete( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_vm_clusters_list_by_resource_group(self, resource_group): + response = self.client.cloud_vm_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_vm_clusters_begin_add_vms(self, resource_group): + response = self.client.cloud_vm_clusters.begin_add_vms( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + body={ + "dbServers": [ + "str" + ] + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_vm_clusters_begin_remove_vms(self, resource_group): + response = self.client.cloud_vm_clusters.begin_remove_vms( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + body={ + "dbServers": [ + "str" + ] + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_vm_clusters_list_private_ip_addresses(self, resource_group): + response = self.client.cloud_vm_clusters.list_private_ip_addresses( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + body={ + "subnetId": "str", + "vnicId": "str" + } +, + ) + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_cloud_vm_clusters_operations_async.py b/generated_tests/test_oracle_database_mgmt_cloud_vm_clusters_operations_async.py new file mode 100644 index 000000000000..c5051355d4a5 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_cloud_vm_clusters_operations_async.py @@ -0,0 +1,280 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtCloudVmClustersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_vm_clusters_list_by_subscription(self, resource_group): + response = self.client.cloud_vm_clusters.list_by_subscription( + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_vm_clusters_begin_create_or_update(self, resource_group): + response = await (await self.client.cloud_vm_clusters.begin_create_or_update( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "cloudExadataInfrastructureId": "str", + "cpuCoreCount": 0, + "displayName": "str", + "giVersion": "str", + "hostname": "str", + "sshPublicKeys": [ + "str" + ], + "subnetId": "str", + "vnetId": "str", + "backupSubnetCidr": "str", + "clusterName": "str", + "compartmentId": "str", + "computeModel": "str", + "computeNodes": [ + "str" + ], + "dataCollectionOptions": { + "isDiagnosticsEventsEnabled": bool, + "isHealthMonitoringEnabled": bool, + "isIncidentLogsEnabled": bool + }, + "dataStoragePercentage": 0, + "dataStorageSizeInTbs": 0.0, + "dbNodeStorageSizeInGbs": 0, + "dbServers": [ + "str" + ], + "diskRedundancy": "str", + "domain": "str", + "fileSystemConfigurationDetails": [ + { + "fileSystemSizeGb": 0, + "mountPoint": "str" + } + ], + "iormConfigCache": { + "dbPlans": [ + { + "dbName": "str", + "flashCacheLimit": "str", + "share": 0 + } + ], + "lifecycleDetails": "str", + "lifecycleState": "str", + "objective": "str" + }, + "isLocalBackupEnabled": bool, + "isSparseDiskgroupEnabled": bool, + "lastUpdateHistoryEntryId": "str", + "licenseModel": "str", + "lifecycleDetails": "str", + "lifecycleState": "str", + "listenerPort": 0, + "memorySizeInGbs": 0, + "nodeCount": 0, + "nsgCidrs": [ + { + "source": "str", + "destinationPortRange": { + "max": 0, + "min": 0 + } + } + ], + "nsgUrl": "str", + "ociUrl": "str", + "ocid": "str", + "ocpuCount": 0.0, + "provisioningState": "str", + "scanDnsName": "str", + "scanDnsRecordId": "str", + "scanIpIds": [ + "str" + ], + "scanListenerPortTcp": 0, + "scanListenerPortTcpSsl": 0, + "shape": "str", + "storageSizeInGbs": 0, + "subnetOcid": "str", + "systemVersion": "str", + "timeCreated": "2020-02-20 00:00:00", + "timeZone": "str", + "vipIds": [ + "str" + ], + "zoneId": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_vm_clusters_get(self, resource_group): + response = await self.client.cloud_vm_clusters.get( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_vm_clusters_begin_update(self, resource_group): + response = await (await self.client.cloud_vm_clusters.begin_update( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + properties={ + "properties": { + "computeNodes": [ + "str" + ], + "cpuCoreCount": 0, + "dataCollectionOptions": { + "isDiagnosticsEventsEnabled": bool, + "isHealthMonitoringEnabled": bool, + "isIncidentLogsEnabled": bool + }, + "dataStorageSizeInTbs": 0.0, + "dbNodeStorageSizeInGbs": 0, + "displayName": "str", + "fileSystemConfigurationDetails": [ + { + "fileSystemSizeGb": 0, + "mountPoint": "str" + } + ], + "licenseModel": "str", + "memorySizeInGbs": 0, + "ocpuCount": 0.0, + "sshPublicKeys": [ + "str" + ], + "storageSizeInGbs": 0 + }, + "tags": { + "str": "str" + } + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_vm_clusters_begin_delete(self, resource_group): + response = await (await self.client.cloud_vm_clusters.begin_delete( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_vm_clusters_list_by_resource_group(self, resource_group): + response = self.client.cloud_vm_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_vm_clusters_begin_add_vms(self, resource_group): + response = await (await self.client.cloud_vm_clusters.begin_add_vms( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + body={ + "dbServers": [ + "str" + ] + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_vm_clusters_begin_remove_vms(self, resource_group): + response = await (await self.client.cloud_vm_clusters.begin_remove_vms( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + body={ + "dbServers": [ + "str" + ] + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_vm_clusters_list_private_ip_addresses(self, resource_group): + response = await self.client.cloud_vm_clusters.list_private_ip_addresses( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + body={ + "subnetId": "str", + "vnicId": "str" + } +, + ) + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_db_nodes_operations.py b/generated_tests/test_oracle_database_mgmt_db_nodes_operations.py new file mode 100644 index 000000000000..39e013549cd7 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_db_nodes_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDbNodesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_db_nodes_get(self, resource_group): + response = self.client.db_nodes.get( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + dbnodeocid="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_db_nodes_list_by_parent(self, resource_group): + response = self.client.db_nodes.list_by_parent( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_db_nodes_begin_action(self, resource_group): + response = self.client.db_nodes.begin_action( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + dbnodeocid="str" +, + body={ + "action": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_db_nodes_operations_async.py b/generated_tests/test_oracle_database_mgmt_db_nodes_operations_async.py new file mode 100644 index 000000000000..957e9c6a4c46 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_db_nodes_operations_async.py @@ -0,0 +1,63 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDbNodesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_db_nodes_get(self, resource_group): + response = await self.client.db_nodes.get( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + dbnodeocid="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_db_nodes_list_by_parent(self, resource_group): + response = self.client.db_nodes.list_by_parent( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_db_nodes_begin_action(self, resource_group): + response = await (await self.client.db_nodes.begin_action( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + dbnodeocid="str" +, + body={ + "action": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_db_servers_operations.py b/generated_tests/test_oracle_database_mgmt_db_servers_operations.py new file mode 100644 index 000000000000..2e995de5037b --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_db_servers_operations.py @@ -0,0 +1,44 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDbServersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_db_servers_get(self, resource_group): + response = self.client.db_servers.get( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + dbserverocid="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_db_servers_list_by_parent(self, resource_group): + response = self.client.db_servers.list_by_parent( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_db_servers_operations_async.py b/generated_tests/test_oracle_database_mgmt_db_servers_operations_async.py new file mode 100644 index 000000000000..a4d13fb067ad --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_db_servers_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDbServersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_db_servers_get(self, resource_group): + response = await self.client.db_servers.get( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + dbserverocid="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_db_servers_list_by_parent(self, resource_group): + response = self.client.db_servers.list_by_parent( + resource_group_name=resource_group.name, + cloudexadatainfrastructurename="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_db_system_shapes_operations.py b/generated_tests/test_oracle_database_mgmt_db_system_shapes_operations.py new file mode 100644 index 000000000000..257ebd08a9bb --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_db_system_shapes_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDbSystemShapesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_db_system_shapes_get(self, resource_group): + response = self.client.db_system_shapes.get( + location="str" +, + dbsystemshapename="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_db_system_shapes_list_by_location(self, resource_group): + response = self.client.db_system_shapes.list_by_location( + location="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_db_system_shapes_operations_async.py b/generated_tests/test_oracle_database_mgmt_db_system_shapes_operations_async.py new file mode 100644 index 000000000000..1b44b4057648 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_db_system_shapes_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDbSystemShapesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_db_system_shapes_get(self, resource_group): + response = await self.client.db_system_shapes.get( + location="str" +, + dbsystemshapename="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_db_system_shapes_list_by_location(self, resource_group): + response = self.client.db_system_shapes.list_by_location( + location="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_dns_private_views_operations.py b/generated_tests/test_oracle_database_mgmt_dns_private_views_operations.py new file mode 100644 index 000000000000..b257f93adabb --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_dns_private_views_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDnsPrivateViewsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dns_private_views_get(self, resource_group): + response = self.client.dns_private_views.get( + location="str" +, + dnsprivateviewocid="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dns_private_views_list_by_location(self, resource_group): + response = self.client.dns_private_views.list_by_location( + location="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_dns_private_views_operations_async.py b/generated_tests/test_oracle_database_mgmt_dns_private_views_operations_async.py new file mode 100644 index 000000000000..3411c8ca484f --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_dns_private_views_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDnsPrivateViewsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dns_private_views_get(self, resource_group): + response = await self.client.dns_private_views.get( + location="str" +, + dnsprivateviewocid="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dns_private_views_list_by_location(self, resource_group): + response = self.client.dns_private_views.list_by_location( + location="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_dns_private_zones_operations.py b/generated_tests/test_oracle_database_mgmt_dns_private_zones_operations.py new file mode 100644 index 000000000000..5e83beb157ce --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_dns_private_zones_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDnsPrivateZonesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dns_private_zones_get(self, resource_group): + response = self.client.dns_private_zones.get( + location="str" +, + dnsprivatezonename="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dns_private_zones_list_by_location(self, resource_group): + response = self.client.dns_private_zones.list_by_location( + location="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_dns_private_zones_operations_async.py b/generated_tests/test_oracle_database_mgmt_dns_private_zones_operations_async.py new file mode 100644 index 000000000000..83fb059a75f5 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_dns_private_zones_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtDnsPrivateZonesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dns_private_zones_get(self, resource_group): + response = await self.client.dns_private_zones.get( + location="str" +, + dnsprivatezonename="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dns_private_zones_list_by_location(self, resource_group): + response = self.client.dns_private_zones.list_by_location( + location="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_exadb_vm_clusters_operations.py b/generated_tests/test_oracle_database_mgmt_exadb_vm_clusters_operations.py new file mode 100644 index 000000000000..48e4e0eca915 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_exadb_vm_clusters_operations.py @@ -0,0 +1,218 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtExadbVmClustersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exadb_vm_clusters_list_by_subscription(self, resource_group): + response = self.client.exadb_vm_clusters.list_by_subscription( + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exadb_vm_clusters_begin_create_or_update(self, resource_group): + response = self.client.exadb_vm_clusters.begin_create_or_update( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "displayName": "str", + "enabledEcpuCount": 0, + "exascaleDbStorageVaultId": "str", + "hostname": "str", + "nodeCount": 0, + "shape": "str", + "sshPublicKeys": [ + "str" + ], + "subnetId": "str", + "totalEcpuCount": 0, + "vmFileSystemStorage": { + "totalSizeInGbs": 0 + }, + "vnetId": "str", + "backupSubnetCidr": "str", + "backupSubnetOcid": "str", + "clusterName": "str", + "dataCollectionOptions": { + "isDiagnosticsEventsEnabled": bool, + "isHealthMonitoringEnabled": bool, + "isIncidentLogsEnabled": bool + }, + "domain": "str", + "giVersion": "str", + "gridImageOcid": "str", + "gridImageType": "str", + "iormConfigCache": { + "dbPlans": [ + { + "dbName": "str", + "flashCacheLimit": "str", + "share": 0 + } + ], + "lifecycleDetails": "str", + "lifecycleState": "str", + "objective": "str" + }, + "licenseModel": "str", + "lifecycleDetails": "str", + "lifecycleState": "str", + "listenerPort": 0, + "memorySizeInGbs": 0, + "nsgCidrs": [ + { + "source": "str", + "destinationPortRange": { + "max": 0, + "min": 0 + } + } + ], + "nsgUrl": "str", + "ociUrl": "str", + "ocid": "str", + "privateZoneOcid": "str", + "provisioningState": "str", + "scanDnsName": "str", + "scanDnsRecordId": "str", + "scanIpIds": [ + "str" + ], + "scanListenerPortTcp": 0, + "scanListenerPortTcpSsl": 0, + "snapshotFileSystemStorage": { + "totalSizeInGbs": 0 + }, + "subnetOcid": "str", + "systemVersion": "str", + "timeZone": "str", + "totalFileSystemStorage": { + "totalSizeInGbs": 0 + }, + "vipIds": [ + "str" + ], + "zoneOcid": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str", + "zones": [ + "str" + ] + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exadb_vm_clusters_get(self, resource_group): + response = self.client.exadb_vm_clusters.get( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exadb_vm_clusters_begin_update(self, resource_group): + response = self.client.exadb_vm_clusters.begin_update( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + properties={ + "properties": { + "nodeCount": 0 + }, + "tags": { + "str": "str" + }, + "zones": [ + "str" + ] + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exadb_vm_clusters_begin_delete(self, resource_group): + response = self.client.exadb_vm_clusters.begin_delete( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exadb_vm_clusters_list_by_resource_group(self, resource_group): + response = self.client.exadb_vm_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exadb_vm_clusters_begin_remove_vms(self, resource_group): + response = self.client.exadb_vm_clusters.begin_remove_vms( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + body={ + "dbNodes": [ + { + "dbNodeId": "str" + } + ] + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_exadb_vm_clusters_operations_async.py b/generated_tests/test_oracle_database_mgmt_exadb_vm_clusters_operations_async.py new file mode 100644 index 000000000000..80577e977228 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_exadb_vm_clusters_operations_async.py @@ -0,0 +1,219 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtExadbVmClustersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exadb_vm_clusters_list_by_subscription(self, resource_group): + response = self.client.exadb_vm_clusters.list_by_subscription( + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exadb_vm_clusters_begin_create_or_update(self, resource_group): + response = await (await self.client.exadb_vm_clusters.begin_create_or_update( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "displayName": "str", + "enabledEcpuCount": 0, + "exascaleDbStorageVaultId": "str", + "hostname": "str", + "nodeCount": 0, + "shape": "str", + "sshPublicKeys": [ + "str" + ], + "subnetId": "str", + "totalEcpuCount": 0, + "vmFileSystemStorage": { + "totalSizeInGbs": 0 + }, + "vnetId": "str", + "backupSubnetCidr": "str", + "backupSubnetOcid": "str", + "clusterName": "str", + "dataCollectionOptions": { + "isDiagnosticsEventsEnabled": bool, + "isHealthMonitoringEnabled": bool, + "isIncidentLogsEnabled": bool + }, + "domain": "str", + "giVersion": "str", + "gridImageOcid": "str", + "gridImageType": "str", + "iormConfigCache": { + "dbPlans": [ + { + "dbName": "str", + "flashCacheLimit": "str", + "share": 0 + } + ], + "lifecycleDetails": "str", + "lifecycleState": "str", + "objective": "str" + }, + "licenseModel": "str", + "lifecycleDetails": "str", + "lifecycleState": "str", + "listenerPort": 0, + "memorySizeInGbs": 0, + "nsgCidrs": [ + { + "source": "str", + "destinationPortRange": { + "max": 0, + "min": 0 + } + } + ], + "nsgUrl": "str", + "ociUrl": "str", + "ocid": "str", + "privateZoneOcid": "str", + "provisioningState": "str", + "scanDnsName": "str", + "scanDnsRecordId": "str", + "scanIpIds": [ + "str" + ], + "scanListenerPortTcp": 0, + "scanListenerPortTcpSsl": 0, + "snapshotFileSystemStorage": { + "totalSizeInGbs": 0 + }, + "subnetOcid": "str", + "systemVersion": "str", + "timeZone": "str", + "totalFileSystemStorage": { + "totalSizeInGbs": 0 + }, + "vipIds": [ + "str" + ], + "zoneOcid": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str", + "zones": [ + "str" + ] + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exadb_vm_clusters_get(self, resource_group): + response = await self.client.exadb_vm_clusters.get( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exadb_vm_clusters_begin_update(self, resource_group): + response = await (await self.client.exadb_vm_clusters.begin_update( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + properties={ + "properties": { + "nodeCount": 0 + }, + "tags": { + "str": "str" + }, + "zones": [ + "str" + ] + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exadb_vm_clusters_begin_delete(self, resource_group): + response = await (await self.client.exadb_vm_clusters.begin_delete( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exadb_vm_clusters_list_by_resource_group(self, resource_group): + response = self.client.exadb_vm_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exadb_vm_clusters_begin_remove_vms(self, resource_group): + response = await (await self.client.exadb_vm_clusters.begin_remove_vms( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + body={ + "dbNodes": [ + { + "dbNodeId": "str" + } + ] + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_exascale_db_nodes_operations.py b/generated_tests/test_oracle_database_mgmt_exascale_db_nodes_operations.py new file mode 100644 index 000000000000..1c64e8ec6ff9 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_exascale_db_nodes_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtExascaleDbNodesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exascale_db_nodes_get(self, resource_group): + response = self.client.exascale_db_nodes.get( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + exascale_db_node_name="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exascale_db_nodes_list_by_parent(self, resource_group): + response = self.client.exascale_db_nodes.list_by_parent( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exascale_db_nodes_begin_action(self, resource_group): + response = self.client.exascale_db_nodes.begin_action( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + exascale_db_node_name="str" +, + body={ + "action": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_exascale_db_nodes_operations_async.py b/generated_tests/test_oracle_database_mgmt_exascale_db_nodes_operations_async.py new file mode 100644 index 000000000000..9fc2cd8939cc --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_exascale_db_nodes_operations_async.py @@ -0,0 +1,63 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtExascaleDbNodesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exascale_db_nodes_get(self, resource_group): + response = await self.client.exascale_db_nodes.get( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + exascale_db_node_name="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exascale_db_nodes_list_by_parent(self, resource_group): + response = self.client.exascale_db_nodes.list_by_parent( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exascale_db_nodes_begin_action(self, resource_group): + response = await (await self.client.exascale_db_nodes.begin_action( + resource_group_name=resource_group.name, + exadb_vm_cluster_name="str" +, + exascale_db_node_name="str" +, + body={ + "action": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_exascale_db_storage_vaults_operations.py b/generated_tests/test_oracle_database_mgmt_exascale_db_storage_vaults_operations.py new file mode 100644 index 000000000000..4b84ab3427f3 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_exascale_db_storage_vaults_operations.py @@ -0,0 +1,131 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtExascaleDbStorageVaultsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exascale_db_storage_vaults_get(self, resource_group): + response = self.client.exascale_db_storage_vaults.get( + resource_group_name=resource_group.name, + exascale_db_storage_vault_name="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exascale_db_storage_vaults_begin_create(self, resource_group): + response = self.client.exascale_db_storage_vaults.begin_create( + resource_group_name=resource_group.name, + exascale_db_storage_vault_name="str" +, + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "displayName": "str", + "highCapacityDatabaseStorageInput": { + "totalSizeInGbs": 0 + }, + "additionalFlashCacheInPercent": 0, + "description": "str", + "highCapacityDatabaseStorage": { + "availableSizeInGbs": 0, + "totalSizeInGbs": 0 + }, + "lifecycleDetails": "str", + "lifecycleState": "str", + "ociUrl": "str", + "ocid": "str", + "provisioningState": "str", + "timeZone": "str", + "vmClusterCount": 0 + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str", + "zones": [ + "str" + ] + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exascale_db_storage_vaults_begin_update(self, resource_group): + response = self.client.exascale_db_storage_vaults.begin_update( + resource_group_name=resource_group.name, + exascale_db_storage_vault_name="str" +, + properties={ + "tags": { + "str": "str" + } + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exascale_db_storage_vaults_begin_delete(self, resource_group): + response = self.client.exascale_db_storage_vaults.begin_delete( + resource_group_name=resource_group.name, + exascale_db_storage_vault_name="str" +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exascale_db_storage_vaults_list_by_resource_group(self, resource_group): + response = self.client.exascale_db_storage_vaults.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_exascale_db_storage_vaults_list_by_subscription(self, resource_group): + response = self.client.exascale_db_storage_vaults.list_by_subscription( + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_exascale_db_storage_vaults_operations_async.py b/generated_tests/test_oracle_database_mgmt_exascale_db_storage_vaults_operations_async.py new file mode 100644 index 000000000000..04b985bd7a39 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_exascale_db_storage_vaults_operations_async.py @@ -0,0 +1,132 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtExascaleDbStorageVaultsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exascale_db_storage_vaults_get(self, resource_group): + response = await self.client.exascale_db_storage_vaults.get( + resource_group_name=resource_group.name, + exascale_db_storage_vault_name="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exascale_db_storage_vaults_begin_create(self, resource_group): + response = await (await self.client.exascale_db_storage_vaults.begin_create( + resource_group_name=resource_group.name, + exascale_db_storage_vault_name="str" +, + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "displayName": "str", + "highCapacityDatabaseStorageInput": { + "totalSizeInGbs": 0 + }, + "additionalFlashCacheInPercent": 0, + "description": "str", + "highCapacityDatabaseStorage": { + "availableSizeInGbs": 0, + "totalSizeInGbs": 0 + }, + "lifecycleDetails": "str", + "lifecycleState": "str", + "ociUrl": "str", + "ocid": "str", + "provisioningState": "str", + "timeZone": "str", + "vmClusterCount": 0 + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str", + "zones": [ + "str" + ] + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exascale_db_storage_vaults_begin_update(self, resource_group): + response = await (await self.client.exascale_db_storage_vaults.begin_update( + resource_group_name=resource_group.name, + exascale_db_storage_vault_name="str" +, + properties={ + "tags": { + "str": "str" + } + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exascale_db_storage_vaults_begin_delete(self, resource_group): + response = await (await self.client.exascale_db_storage_vaults.begin_delete( + resource_group_name=resource_group.name, + exascale_db_storage_vault_name="str" +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exascale_db_storage_vaults_list_by_resource_group(self, resource_group): + response = self.client.exascale_db_storage_vaults.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_exascale_db_storage_vaults_list_by_subscription(self, resource_group): + response = self.client.exascale_db_storage_vaults.list_by_subscription( + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_flex_components_operations.py b/generated_tests/test_oracle_database_mgmt_flex_components_operations.py new file mode 100644 index 000000000000..d4bf85077ef3 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_flex_components_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtFlexComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_flex_components_get(self, resource_group): + response = self.client.flex_components.get( + location="str" +, + flex_component_name="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_flex_components_list_by_parent(self, resource_group): + response = self.client.flex_components.list_by_parent( + location="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_flex_components_operations_async.py b/generated_tests/test_oracle_database_mgmt_flex_components_operations_async.py new file mode 100644 index 000000000000..8e29a3252088 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_flex_components_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtFlexComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_flex_components_get(self, resource_group): + response = await self.client.flex_components.get( + location="str" +, + flex_component_name="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_flex_components_list_by_parent(self, resource_group): + response = self.client.flex_components.list_by_parent( + location="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_gi_minor_versions_operations.py b/generated_tests/test_oracle_database_mgmt_gi_minor_versions_operations.py new file mode 100644 index 000000000000..c6f2c7eda37a --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_gi_minor_versions_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtGiMinorVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gi_minor_versions_list_by_parent(self, resource_group): + response = self.client.gi_minor_versions.list_by_parent( + location="str" +, + giversionname="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gi_minor_versions_get(self, resource_group): + response = self.client.gi_minor_versions.get( + location="str" +, + giversionname="str" +, + gi_minor_version_name="str" +, + ) + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_gi_minor_versions_operations_async.py b/generated_tests/test_oracle_database_mgmt_gi_minor_versions_operations_async.py new file mode 100644 index 000000000000..3594bc55b150 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_gi_minor_versions_operations_async.py @@ -0,0 +1,47 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtGiMinorVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gi_minor_versions_list_by_parent(self, resource_group): + response = self.client.gi_minor_versions.list_by_parent( + location="str" +, + giversionname="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gi_minor_versions_get(self, resource_group): + response = await self.client.gi_minor_versions.get( + location="str" +, + giversionname="str" +, + gi_minor_version_name="str" +, + ) + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_gi_versions_operations.py b/generated_tests/test_oracle_database_mgmt_gi_versions_operations.py new file mode 100644 index 000000000000..3c872599d069 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_gi_versions_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtGiVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gi_versions_get(self, resource_group): + response = self.client.gi_versions.get( + location="str" +, + giversionname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gi_versions_list_by_location(self, resource_group): + response = self.client.gi_versions.list_by_location( + location="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_gi_versions_operations_async.py b/generated_tests/test_oracle_database_mgmt_gi_versions_operations_async.py new file mode 100644 index 000000000000..c5b096df0385 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_gi_versions_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtGiVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gi_versions_get(self, resource_group): + response = await self.client.gi_versions.get( + location="str" +, + giversionname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gi_versions_list_by_location(self, resource_group): + response = self.client.gi_versions.list_by_location( + location="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_operations.py b/generated_tests/test_oracle_database_mgmt_operations.py new file mode 100644 index 000000000000..9ab057a15dcc --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_operations.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list( + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_operations_async.py b/generated_tests/test_oracle_database_mgmt_operations_async.py new file mode 100644 index 000000000000..083a09bb446d --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_operations_async.py @@ -0,0 +1,28 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list( + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_oracle_subscriptions_operations.py b/generated_tests/test_oracle_database_mgmt_oracle_subscriptions_operations.py new file mode 100644 index 000000000000..1c70103a7b28 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_oracle_subscriptions_operations.py @@ -0,0 +1,154 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtOracleSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_oracle_subscriptions_list_by_subscription(self, resource_group): + response = self.client.oracle_subscriptions.list_by_subscription( + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_oracle_subscriptions_begin_create_or_update(self, resource_group): + response = self.client.oracle_subscriptions.begin_create_or_update( + resource={ + "id": "str", + "name": "str", + "plan": { + "name": "str", + "product": "str", + "publisher": "str", + "promotionCode": "str", + "version": "str" + }, + "properties": { + "addSubscriptionOperationState": "str", + "azureSubscriptionIds": [ + "str" + ], + "cloudAccountId": "str", + "cloudAccountState": "str", + "intent": "str", + "lastOperationStatusDetail": "str", + "productCode": "str", + "provisioningState": "str", + "saasSubscriptionId": "str", + "termUnit": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_oracle_subscriptions_get(self, resource_group): + response = self.client.oracle_subscriptions.get( + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_oracle_subscriptions_begin_update(self, resource_group): + response = self.client.oracle_subscriptions.begin_update( + properties={ + "plan": { + "name": "str", + "product": "str", + "promotionCode": "str", + "publisher": "str", + "version": "str" + }, + "properties": { + "intent": "str", + "productCode": "str" + } + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_oracle_subscriptions_begin_delete(self, resource_group): + response = self.client.oracle_subscriptions.begin_delete( + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_oracle_subscriptions_begin_list_cloud_account_details(self, resource_group): + response = self.client.oracle_subscriptions.begin_list_cloud_account_details( + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_oracle_subscriptions_begin_list_saas_subscription_details(self, resource_group): + response = self.client.oracle_subscriptions.begin_list_saas_subscription_details( + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_oracle_subscriptions_begin_list_activation_links(self, resource_group): + response = self.client.oracle_subscriptions.begin_list_activation_links( + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_oracle_subscriptions_begin_add_azure_subscriptions(self, resource_group): + response = self.client.oracle_subscriptions.begin_add_azure_subscriptions( + body={ + "azureSubscriptionIds": [ + "str" + ] + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_oracle_subscriptions_operations_async.py b/generated_tests/test_oracle_database_mgmt_oracle_subscriptions_operations_async.py new file mode 100644 index 000000000000..667ae253b4ab --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_oracle_subscriptions_operations_async.py @@ -0,0 +1,155 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtOracleSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_oracle_subscriptions_list_by_subscription(self, resource_group): + response = self.client.oracle_subscriptions.list_by_subscription( + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_oracle_subscriptions_begin_create_or_update(self, resource_group): + response = await (await self.client.oracle_subscriptions.begin_create_or_update( + resource={ + "id": "str", + "name": "str", + "plan": { + "name": "str", + "product": "str", + "publisher": "str", + "promotionCode": "str", + "version": "str" + }, + "properties": { + "addSubscriptionOperationState": "str", + "azureSubscriptionIds": [ + "str" + ], + "cloudAccountId": "str", + "cloudAccountState": "str", + "intent": "str", + "lastOperationStatusDetail": "str", + "productCode": "str", + "provisioningState": "str", + "saasSubscriptionId": "str", + "termUnit": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_oracle_subscriptions_get(self, resource_group): + response = await self.client.oracle_subscriptions.get( + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_oracle_subscriptions_begin_update(self, resource_group): + response = await (await self.client.oracle_subscriptions.begin_update( + properties={ + "plan": { + "name": "str", + "product": "str", + "promotionCode": "str", + "publisher": "str", + "version": "str" + }, + "properties": { + "intent": "str", + "productCode": "str" + } + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_oracle_subscriptions_begin_delete(self, resource_group): + response = await (await self.client.oracle_subscriptions.begin_delete( + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_oracle_subscriptions_begin_list_cloud_account_details(self, resource_group): + response = await (await self.client.oracle_subscriptions.begin_list_cloud_account_details( + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_oracle_subscriptions_begin_list_saas_subscription_details(self, resource_group): + response = await (await self.client.oracle_subscriptions.begin_list_saas_subscription_details( + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_oracle_subscriptions_begin_list_activation_links(self, resource_group): + response = await (await self.client.oracle_subscriptions.begin_list_activation_links( + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_oracle_subscriptions_begin_add_azure_subscriptions(self, resource_group): + response = await (await self.client.oracle_subscriptions.begin_add_azure_subscriptions( + body={ + "azureSubscriptionIds": [ + "str" + ] + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_system_versions_operations.py b/generated_tests/test_oracle_database_mgmt_system_versions_operations.py new file mode 100644 index 000000000000..b4adf18c624f --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_system_versions_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtSystemVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_versions_get(self, resource_group): + response = self.client.system_versions.get( + location="str" +, + systemversionname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_versions_list_by_location(self, resource_group): + response = self.client.system_versions.list_by_location( + location="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_system_versions_operations_async.py b/generated_tests/test_oracle_database_mgmt_system_versions_operations_async.py new file mode 100644 index 000000000000..fe8f8694a888 --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_system_versions_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtSystemVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_versions_get(self, resource_group): + response = await self.client.system_versions.get( + location="str" +, + systemversionname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_versions_list_by_location(self, resource_group): + response = self.client.system_versions.list_by_location( + location="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_virtual_network_addresses_operations.py b/generated_tests/test_oracle_database_mgmt_virtual_network_addresses_operations.py new file mode 100644 index 000000000000..d226f827144f --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_virtual_network_addresses_operations.py @@ -0,0 +1,96 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtVirtualNetworkAddressesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_network_addresses_begin_create_or_update(self, resource_group): + response = self.client.virtual_network_addresses.begin_create_or_update( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + virtualnetworkaddressname="str" +, + resource={ + "id": "str", + "name": "str", + "properties": { + "domain": "str", + "ipAddress": "str", + "lifecycleDetails": "str", + "lifecycleState": "str", + "ocid": "str", + "provisioningState": "str", + "timeAssigned": "2020-02-20 00:00:00", + "vmOcid": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_network_addresses_get(self, resource_group): + response = self.client.virtual_network_addresses.get( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + virtualnetworkaddressname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_network_addresses_begin_delete(self, resource_group): + response = self.client.virtual_network_addresses.begin_delete( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + virtualnetworkaddressname="str" +, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_network_addresses_list_by_parent(self, resource_group): + response = self.client.virtual_network_addresses.list_by_parent( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + diff --git a/generated_tests/test_oracle_database_mgmt_virtual_network_addresses_operations_async.py b/generated_tests/test_oracle_database_mgmt_virtual_network_addresses_operations_async.py new file mode 100644 index 000000000000..3c74fc645d4c --- /dev/null +++ b/generated_tests/test_oracle_database_mgmt_virtual_network_addresses_operations_async.py @@ -0,0 +1,97 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.oracledatabase.aio import OracleDatabaseMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestOracleDatabaseMgmtVirtualNetworkAddressesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_network_addresses_begin_create_or_update(self, resource_group): + response = await (await self.client.virtual_network_addresses.begin_create_or_update( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + virtualnetworkaddressname="str" +, + resource={ + "id": "str", + "name": "str", + "properties": { + "domain": "str", + "ipAddress": "str", + "lifecycleDetails": "str", + "lifecycleState": "str", + "ocid": "str", + "provisioningState": "str", + "timeAssigned": "2020-02-20 00:00:00", + "vmOcid": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_network_addresses_get(self, resource_group): + response = await self.client.virtual_network_addresses.get( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + virtualnetworkaddressname="str" +, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_network_addresses_begin_delete(self, resource_group): + response = await (await self.client.virtual_network_addresses.begin_delete( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + virtualnetworkaddressname="str" +, + )).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_network_addresses_list_by_parent(self, resource_group): + response = self.client.virtual_network_addresses.list_by_parent( + resource_group_name=resource_group.name, + cloudvmclustername="str" +, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + diff --git a/sdk/oracledatabase/arm-oracledatabase/CHANGELOG.md b/sdk/oracledatabase/arm-oracledatabase/CHANGELOG.md new file mode 100644 index 000000000000..628743d283a9 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (1970-01-01) + +- Initial version diff --git a/sdk/oracledatabase/arm-oracledatabase/LICENSE b/sdk/oracledatabase/arm-oracledatabase/LICENSE new file mode 100644 index 000000000000..63447fd8bbbf --- /dev/null +++ b/sdk/oracledatabase/arm-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. \ No newline at end of file diff --git a/sdk/oracledatabase/arm-oracledatabase/MANIFEST.in b/sdk/oracledatabase/arm-oracledatabase/MANIFEST.in new file mode 100644 index 000000000000..92f60d146273 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/MANIFEST.in @@ -0,0 +1,7 @@ +include *.md +include LICENSE +include azure/mgmt/oracledatabase/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/oracledatabase/arm-oracledatabase/README.md b/sdk/oracledatabase/arm-oracledatabase/README.md new file mode 100644 index 000000000000..47fc676e2c3f --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/README.md @@ -0,0 +1,78 @@ +# Azure Mgmt Oracledatabase client library for Python + + +## Getting started + +### Install the package + +```bash +python -m pip install azure-mgmt-oracledatabase +``` + +#### Prequisites + +- Python 3.8 or later is required to use this package. +- You need an [Azure subscription][azure_sub] to use this package. +- An existing Azure Mgmt Oracledatabase instance. + +#### Create with an Azure Active Directory Credential +To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], +provide an instance of the desired credential type obtained from the +[azure-identity][azure_identity_credentials] library. + +To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] + +After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. +As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client: + +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` + +Use the returned token credential to authenticate the client: + +```python +>>> from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient +>>> from azure.identity import DefaultAzureCredential +>>> client = OracleDatabaseMgmtClient(endpoint='', credential=DefaultAzureCredential()) +``` + +## Examples + +```python +>>> from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient +>>> from azure.identity import DefaultAzureCredential +>>> from azure.core.exceptions import HttpResponseError + +>>> client = OracleDatabaseMgmtClient(endpoint='', credential=DefaultAzureCredential()) +>>> try: + + except HttpResponseError as e: + print('service responds error: {}'.format(e.response.json())) + +``` + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, +see the Code of Conduct FAQ or contact opencode@microsoft.com with any +additional questions or comments. + + +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ +[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials +[azure_identity_pip]: https://pypi.org/project/azure-identity/ +[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential +[pip]: https://pypi.org/project/pip/ +[azure_sub]: https://azure.microsoft.com/free/ diff --git a/sdk/oracledatabase/arm-oracledatabase/__init__.py b/sdk/oracledatabase/arm-oracledatabase/__init__.py new file mode 100644 index 000000000000..d55ccad1f573 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/oracledatabase/arm-oracledatabase/_client.py b/sdk/oracledatabase/arm-oracledatabase/_client.py new file mode 100644 index 000000000000..5551e6e99f74 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/_client.py @@ -0,0 +1,244 @@ +# 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) Python 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 typing_extensions import Self + +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 ._configuration import OracleDatabaseMgmtClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import ( + AutonomousDatabaseBackupsOperations, + AutonomousDatabaseCharacterSetsOperations, + AutonomousDatabaseNationalCharacterSetsOperations, + AutonomousDatabaseVersionsOperations, + AutonomousDatabasesOperations, + CloudExadataInfrastructuresOperations, + CloudVmClustersOperations, + DbNodesOperations, + DbServersOperations, + DbSystemShapesOperations, + DnsPrivateViewsOperations, + DnsPrivateZonesOperations, + ExadbVmClustersOperations, + ExascaleDbNodesOperations, + ExascaleDbStorageVaultsOperations, + FlexComponentsOperations, + GiMinorVersionsOperations, + GiVersionsOperations, + ListActionsOperations, + Operations, + OracleSubscriptionsOperations, + SystemVersionsOperations, + VirtualNetworkAddressesOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class OracleDatabaseMgmtClient: # pylint: disable=too-many-instance-attributes + """OracleDatabaseMgmtClient. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.oracledatabase.operations.Operations + :ivar cloud_exadata_infrastructures: CloudExadataInfrastructuresOperations operations + :vartype cloud_exadata_infrastructures: + azure.mgmt.oracledatabase.operations.CloudExadataInfrastructuresOperations + :ivar list_actions: ListActionsOperations operations + :vartype list_actions: azure.mgmt.oracledatabase.operations.ListActionsOperations + :ivar db_servers: DbServersOperations operations + :vartype db_servers: azure.mgmt.oracledatabase.operations.DbServersOperations + :ivar cloud_vm_clusters: CloudVmClustersOperations operations + :vartype cloud_vm_clusters: azure.mgmt.oracledatabase.operations.CloudVmClustersOperations + :ivar virtual_network_addresses: VirtualNetworkAddressesOperations operations + :vartype virtual_network_addresses: + azure.mgmt.oracledatabase.operations.VirtualNetworkAddressesOperations + :ivar system_versions: SystemVersionsOperations operations + :vartype system_versions: azure.mgmt.oracledatabase.operations.SystemVersionsOperations + :ivar oracle_subscriptions: OracleSubscriptionsOperations operations + :vartype oracle_subscriptions: + azure.mgmt.oracledatabase.operations.OracleSubscriptionsOperations + :ivar db_nodes: DbNodesOperations operations + :vartype db_nodes: azure.mgmt.oracledatabase.operations.DbNodesOperations + :ivar gi_versions: GiVersionsOperations operations + :vartype gi_versions: azure.mgmt.oracledatabase.operations.GiVersionsOperations + :ivar gi_minor_versions: GiMinorVersionsOperations operations + :vartype gi_minor_versions: azure.mgmt.oracledatabase.operations.GiMinorVersionsOperations + :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 flex_components: FlexComponentsOperations operations + :vartype flex_components: azure.mgmt.oracledatabase.operations.FlexComponentsOperations + :ivar autonomous_databases: AutonomousDatabasesOperations operations + :vartype autonomous_databases: + azure.mgmt.oracledatabase.operations.AutonomousDatabasesOperations + :ivar autonomous_database_backups: AutonomousDatabaseBackupsOperations operations + :vartype autonomous_database_backups: + azure.mgmt.oracledatabase.operations.AutonomousDatabaseBackupsOperations + :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 exadb_vm_clusters: ExadbVmClustersOperations operations + :vartype exadb_vm_clusters: azure.mgmt.oracledatabase.operations.ExadbVmClustersOperations + :ivar exascale_db_nodes: ExascaleDbNodesOperations operations + :vartype exascale_db_nodes: azure.mgmt.oracledatabase.operations.ExascaleDbNodesOperations + :ivar exascale_db_storage_vaults: ExascaleDbStorageVaultsOperations operations + :vartype exascale_db_storage_vaults: + azure.mgmt.oracledatabase.operations.ExascaleDbStorageVaultsOperations + :param credential: Credential used to authenticate requests to the service. 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 host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2025-03-01". + 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: + _endpoint = "{endpoint}" + self._config = OracleDatabaseMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, base_url=base_url, **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=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_exadata_infrastructures = CloudExadataInfrastructuresOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.list_actions = ListActionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.db_servers = DbServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_vm_clusters = CloudVmClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_network_addresses = VirtualNetworkAddressesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.system_versions = SystemVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.oracle_subscriptions = OracleSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.db_nodes = DbNodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gi_versions = GiVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gi_minor_versions = GiMinorVersionsOperations( + 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.flex_components = FlexComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.autonomous_databases = AutonomousDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_backups = AutonomousDatabaseBackupsOperations( + 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.exadb_vm_clusters = ExadbVmClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.exascale_db_nodes = ExascaleDbNodesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.exascale_db_storage_vaults = ExascaleDbStorageVaultsOperations( + 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) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/oracledatabase/arm-oracledatabase/_configuration.py b/sdk/oracledatabase/arm-oracledatabase/_configuration.py new file mode 100644 index 000000000000..bdf1c6c7e2e0 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/_configuration.py @@ -0,0 +1,73 @@ +# 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) Python 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: + from azure.core.credentials import TokenCredential + + +class OracleDatabaseMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for OracleDatabaseMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential used to authenticate requests to the service. 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 host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2025-03-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-03-01") + + 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.base_url = base_url + 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/oracledatabase/arm-oracledatabase/_model_base.py b/sdk/oracledatabase/arm-oracledatabase/_model_base.py new file mode 100644 index 000000000000..3072ee252ed9 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/_model_base.py @@ -0,0 +1,1235 @@ +# pylint: disable=too-many-lines +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_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}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _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") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object + def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field( + attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str +) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: typing.Set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) # pylint: disable=no-value-for-parameter + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: typing.Dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + if annotation._name == "Dict": # pyright: ignore + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, typing.List[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[typing.Dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: typing.Dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: typing.List[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/oracledatabase/arm-oracledatabase/_patch.py b/sdk/oracledatabase/arm-oracledatabase/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/oracledatabase/arm-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/oracledatabase/arm-oracledatabase/_serialization.py b/sdk/oracledatabase/arm-oracledatabase/_serialization.py new file mode 100644 index 000000000000..7a0232de5ddc --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/_serialization.py @@ -0,0 +1,2050 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# -------------------------------------------------------------------------- +# +# 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. +# +# -------------------------------------------------------------------------- + +# 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, + MutableMapping, + List, +) + +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 typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +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. + :return: The deserialized data. + :rtype: object + """ + 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) from 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 + elif content_type.startswith("text/"): + return data_as_str + 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" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # 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 + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[Dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + 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. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + 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. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + 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( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + 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 bool keep_readonly: If you want to serialize the readonly attributes + :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( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @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: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """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 + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """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 function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + 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)) # pylint: disable=protected-access + 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. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + 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.get(rest_api_response_key, None) or response.get(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 + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """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) -> 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( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object 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. + :returns: The serialized data. + """ + 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() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + 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 + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object 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 + :returns: The serialized request body + """ + + # 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) # pylint: disable=protected-access + 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 str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :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 as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + 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 as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object 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 + :returns: The serialized header + """ + 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 as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + 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) + + if 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 + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + 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 obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + """ + 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 # pylint: disable=eval-used + + @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 str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + 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) + 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 data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + 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. + :rtype: dict + :return: serialized dictionary + """ + 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): # pylint: disable=too-many-return-statements + """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 + :return: serialized object + """ + 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 + if 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 as exc: + 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)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + 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): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + 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): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + 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): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + 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): # pylint: disable=unused-argument + """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 + :return: serialied unix + """ + 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 as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + 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( # pylint: disable=unused-argument, inconsistent-return-statements + 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): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + 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): # pylint: disable=unused-argument + """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" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + 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): # pylint: disable=unused-argument,too-many-return-statements + 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 + 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 + # 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: + """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}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> 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. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """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. + :rtype: 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(): # pylint: disable=protected-access + 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) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + 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 + 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. + :return: The classified target object and its class name. + :rtype: tuple + """ + 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 # pylint: disable=protected-access + 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. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-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 obj raw_data: Data to be processed. + :param str 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 + :rtype: object + :return: Unpacked content. + """ + # 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 response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + 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 # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from 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) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """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. + :rtype: 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 [ # pylint: disable=unnecessary-lambda-assignment + "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 + 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. + :return: Deserialized 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. + :return: Deserialized 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): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :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 + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """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. + :return: Deserialized basic 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 "" + # 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) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if 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 # pylint: disable=eval-used + + @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. + :return: Deserialized string. + :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) + 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. + :return: Deserialized enum object. + :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 as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + 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. + :return: Deserialized bytearray + :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. + :return: Deserialized base64 string + :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. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + 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. + :return: Deserialized int + :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. + :return: Deserialized duration + :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 + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :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. + :return: Deserialized time + :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. + :return: Deserialized RFC datetime + :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=datetime.timezone(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 + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :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 + 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. + :return: Deserialized datetime + :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 + return date_obj diff --git a/sdk/oracledatabase/arm-oracledatabase/_validation.py b/sdk/oracledatabase/arm-oracledatabase/_validation.py new file mode 100644 index 000000000000..752b2822f9d3 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/_validation.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if method_added_on > client_api_version: + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and api_version > client_api_version + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/sdk/oracledatabase/arm-oracledatabase/_version.py b/sdk/oracledatabase/arm-oracledatabase/_version.py new file mode 100644 index 000000000000..be71c81bd282 --- /dev/null +++ b/sdk/oracledatabase/arm-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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/oracledatabase/arm-oracledatabase/aio/__init__.py b/sdk/oracledatabase/arm-oracledatabase/aio/__init__.py new file mode 100644 index 000000000000..d03d7ba95c49 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/aio/__init__.py @@ -0,0 +1,29 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import OracleDatabaseMgmtClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch 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__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/oracledatabase/arm-oracledatabase/aio/_client.py b/sdk/oracledatabase/arm-oracledatabase/aio/_client.py new file mode 100644 index 000000000000..cb6db869cd55 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/aio/_client.py @@ -0,0 +1,246 @@ +# 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) Python 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 typing_extensions import Self + +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 .._serialization import Deserializer, Serializer +from ._configuration import OracleDatabaseMgmtClientConfiguration +from .operations import ( + AutonomousDatabaseBackupsOperations, + AutonomousDatabaseCharacterSetsOperations, + AutonomousDatabaseNationalCharacterSetsOperations, + AutonomousDatabaseVersionsOperations, + AutonomousDatabasesOperations, + CloudExadataInfrastructuresOperations, + CloudVmClustersOperations, + DbNodesOperations, + DbServersOperations, + DbSystemShapesOperations, + DnsPrivateViewsOperations, + DnsPrivateZonesOperations, + ExadbVmClustersOperations, + ExascaleDbNodesOperations, + ExascaleDbStorageVaultsOperations, + FlexComponentsOperations, + GiMinorVersionsOperations, + GiVersionsOperations, + ListActionsOperations, + Operations, + OracleSubscriptionsOperations, + SystemVersionsOperations, + VirtualNetworkAddressesOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class OracleDatabaseMgmtClient: # pylint: disable=too-many-instance-attributes + """OracleDatabaseMgmtClient. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.oracledatabase.aio.operations.Operations + :ivar cloud_exadata_infrastructures: CloudExadataInfrastructuresOperations operations + :vartype cloud_exadata_infrastructures: + azure.mgmt.oracledatabase.aio.operations.CloudExadataInfrastructuresOperations + :ivar list_actions: ListActionsOperations operations + :vartype list_actions: azure.mgmt.oracledatabase.aio.operations.ListActionsOperations + :ivar db_servers: DbServersOperations operations + :vartype db_servers: azure.mgmt.oracledatabase.aio.operations.DbServersOperations + :ivar cloud_vm_clusters: CloudVmClustersOperations operations + :vartype cloud_vm_clusters: azure.mgmt.oracledatabase.aio.operations.CloudVmClustersOperations + :ivar virtual_network_addresses: VirtualNetworkAddressesOperations operations + :vartype virtual_network_addresses: + azure.mgmt.oracledatabase.aio.operations.VirtualNetworkAddressesOperations + :ivar system_versions: SystemVersionsOperations operations + :vartype system_versions: azure.mgmt.oracledatabase.aio.operations.SystemVersionsOperations + :ivar oracle_subscriptions: OracleSubscriptionsOperations operations + :vartype oracle_subscriptions: + azure.mgmt.oracledatabase.aio.operations.OracleSubscriptionsOperations + :ivar db_nodes: DbNodesOperations operations + :vartype db_nodes: azure.mgmt.oracledatabase.aio.operations.DbNodesOperations + :ivar gi_versions: GiVersionsOperations operations + :vartype gi_versions: azure.mgmt.oracledatabase.aio.operations.GiVersionsOperations + :ivar gi_minor_versions: GiMinorVersionsOperations operations + :vartype gi_minor_versions: azure.mgmt.oracledatabase.aio.operations.GiMinorVersionsOperations + :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 flex_components: FlexComponentsOperations operations + :vartype flex_components: azure.mgmt.oracledatabase.aio.operations.FlexComponentsOperations + :ivar autonomous_databases: AutonomousDatabasesOperations operations + :vartype autonomous_databases: + azure.mgmt.oracledatabase.aio.operations.AutonomousDatabasesOperations + :ivar autonomous_database_backups: AutonomousDatabaseBackupsOperations operations + :vartype autonomous_database_backups: + azure.mgmt.oracledatabase.aio.operations.AutonomousDatabaseBackupsOperations + :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 exadb_vm_clusters: ExadbVmClustersOperations operations + :vartype exadb_vm_clusters: azure.mgmt.oracledatabase.aio.operations.ExadbVmClustersOperations + :ivar exascale_db_nodes: ExascaleDbNodesOperations operations + :vartype exascale_db_nodes: azure.mgmt.oracledatabase.aio.operations.ExascaleDbNodesOperations + :ivar exascale_db_storage_vaults: ExascaleDbStorageVaultsOperations operations + :vartype exascale_db_storage_vaults: + azure.mgmt.oracledatabase.aio.operations.ExascaleDbStorageVaultsOperations + :param credential: Credential used to authenticate requests to the service. 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 host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2025-03-01". + 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: + _endpoint = "{endpoint}" + self._config = OracleDatabaseMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, base_url=base_url, **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=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_exadata_infrastructures = CloudExadataInfrastructuresOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.list_actions = ListActionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.db_servers = DbServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_vm_clusters = CloudVmClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_network_addresses = VirtualNetworkAddressesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.system_versions = SystemVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.oracle_subscriptions = OracleSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.db_nodes = DbNodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gi_versions = GiVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gi_minor_versions = GiMinorVersionsOperations( + 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.flex_components = FlexComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.autonomous_databases = AutonomousDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_backups = AutonomousDatabaseBackupsOperations( + 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.exadb_vm_clusters = ExadbVmClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.exascale_db_nodes = ExascaleDbNodesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.exascale_db_storage_vaults = ExascaleDbStorageVaultsOperations( + 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) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + 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) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/oracledatabase/arm-oracledatabase/aio/_configuration.py b/sdk/oracledatabase/arm-oracledatabase/aio/_configuration.py new file mode 100644 index 000000000000..70d44be48177 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/aio/_configuration.py @@ -0,0 +1,73 @@ +# 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) Python 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: + from azure.core.credentials_async import AsyncTokenCredential + + +class OracleDatabaseMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for OracleDatabaseMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential used to authenticate requests to the service. 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 host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2025-03-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-03-01") + + 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.base_url = base_url + 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/oracledatabase/arm-oracledatabase/aio/_patch.py b/sdk/oracledatabase/arm-oracledatabase/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/oracledatabase/arm-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/oracledatabase/arm-oracledatabase/aio/operations/__init__.py b/sdk/oracledatabase/arm-oracledatabase/aio/operations/__init__.py new file mode 100644 index 000000000000..f84dee0a8172 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/aio/operations/__init__.py @@ -0,0 +1,69 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import CloudExadataInfrastructuresOperations # type: ignore +from ._operations import ListActionsOperations # type: ignore +from ._operations import DbServersOperations # type: ignore +from ._operations import CloudVmClustersOperations # type: ignore +from ._operations import VirtualNetworkAddressesOperations # type: ignore +from ._operations import SystemVersionsOperations # type: ignore +from ._operations import OracleSubscriptionsOperations # type: ignore +from ._operations import DbNodesOperations # type: ignore +from ._operations import GiVersionsOperations # type: ignore +from ._operations import GiMinorVersionsOperations # type: ignore +from ._operations import DbSystemShapesOperations # type: ignore +from ._operations import DnsPrivateViewsOperations # type: ignore +from ._operations import DnsPrivateZonesOperations # type: ignore +from ._operations import FlexComponentsOperations # type: ignore +from ._operations import AutonomousDatabasesOperations # type: ignore +from ._operations import AutonomousDatabaseBackupsOperations # type: ignore +from ._operations import AutonomousDatabaseCharacterSetsOperations # type: ignore +from ._operations import AutonomousDatabaseNationalCharacterSetsOperations # type: ignore +from ._operations import AutonomousDatabaseVersionsOperations # type: ignore +from ._operations import ExadbVmClustersOperations # type: ignore +from ._operations import ExascaleDbNodesOperations # type: ignore +from ._operations import ExascaleDbStorageVaultsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "CloudExadataInfrastructuresOperations", + "ListActionsOperations", + "DbServersOperations", + "CloudVmClustersOperations", + "VirtualNetworkAddressesOperations", + "SystemVersionsOperations", + "OracleSubscriptionsOperations", + "DbNodesOperations", + "GiVersionsOperations", + "GiMinorVersionsOperations", + "DbSystemShapesOperations", + "DnsPrivateViewsOperations", + "DnsPrivateZonesOperations", + "FlexComponentsOperations", + "AutonomousDatabasesOperations", + "AutonomousDatabaseBackupsOperations", + "AutonomousDatabaseCharacterSetsOperations", + "AutonomousDatabaseNationalCharacterSetsOperations", + "AutonomousDatabaseVersionsOperations", + "ExadbVmClustersOperations", + "ExascaleDbNodesOperations", + "ExascaleDbStorageVaultsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/oracledatabase/arm-oracledatabase/aio/operations/_operations.py b/sdk/oracledatabase/arm-oracledatabase/aio/operations/_operations.py new file mode 100644 index 000000000000..95f8a8929284 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/aio/operations/_operations.py @@ -0,0 +1,12349 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._serialization import Deserializer, Serializer +from ..._validation import api_version_validation +from ...operations._operations import ( + build_autonomous_database_backups_create_or_update_request, + build_autonomous_database_backups_delete_request, + build_autonomous_database_backups_get_request, + build_autonomous_database_backups_list_by_parent_request, + build_autonomous_database_backups_update_request, + build_autonomous_database_character_sets_get_request, + build_autonomous_database_character_sets_list_by_location_request, + build_autonomous_database_national_character_sets_get_request, + build_autonomous_database_national_character_sets_list_by_location_request, + build_autonomous_database_versions_get_request, + build_autonomous_database_versions_list_by_location_request, + build_autonomous_databases_change_disaster_recovery_configuration_request, + build_autonomous_databases_create_or_update_request, + build_autonomous_databases_delete_request, + build_autonomous_databases_failover_request, + build_autonomous_databases_generate_wallet_request, + build_autonomous_databases_get_request, + build_autonomous_databases_list_by_resource_group_request, + build_autonomous_databases_list_by_subscription_request, + build_autonomous_databases_restore_request, + build_autonomous_databases_shrink_request, + build_autonomous_databases_switchover_request, + build_autonomous_databases_update_request, + build_cloud_exadata_infrastructures_add_storage_capacity_request, + build_cloud_exadata_infrastructures_create_or_update_request, + build_cloud_exadata_infrastructures_delete_request, + build_cloud_exadata_infrastructures_get_request, + build_cloud_exadata_infrastructures_list_by_resource_group_request, + build_cloud_exadata_infrastructures_list_by_subscription_request, + build_cloud_exadata_infrastructures_update_request, + build_cloud_vm_clusters_add_vms_request, + build_cloud_vm_clusters_create_or_update_request, + build_cloud_vm_clusters_delete_request, + build_cloud_vm_clusters_get_request, + build_cloud_vm_clusters_list_by_resource_group_request, + build_cloud_vm_clusters_list_by_subscription_request, + build_cloud_vm_clusters_list_private_ip_addresses_request, + build_cloud_vm_clusters_remove_vms_request, + build_cloud_vm_clusters_update_request, + build_db_nodes_action_request, + build_db_nodes_get_request, + build_db_nodes_list_by_parent_request, + build_db_servers_get_request, + build_db_servers_list_by_parent_request, + build_db_system_shapes_get_request, + build_db_system_shapes_list_by_location_request, + build_dns_private_views_get_request, + build_dns_private_views_list_by_location_request, + build_dns_private_zones_get_request, + build_dns_private_zones_list_by_location_request, + build_exadb_vm_clusters_create_or_update_request, + build_exadb_vm_clusters_delete_request, + build_exadb_vm_clusters_get_request, + build_exadb_vm_clusters_list_by_resource_group_request, + build_exadb_vm_clusters_list_by_subscription_request, + build_exadb_vm_clusters_remove_vms_request, + build_exadb_vm_clusters_update_request, + build_exascale_db_nodes_action_request, + build_exascale_db_nodes_get_request, + build_exascale_db_nodes_list_by_parent_request, + build_exascale_db_storage_vaults_create_request, + build_exascale_db_storage_vaults_delete_request, + build_exascale_db_storage_vaults_get_request, + build_exascale_db_storage_vaults_list_by_resource_group_request, + build_exascale_db_storage_vaults_list_by_subscription_request, + build_exascale_db_storage_vaults_update_request, + build_flex_components_get_request, + build_flex_components_list_by_parent_request, + build_gi_minor_versions_get_request, + build_gi_minor_versions_list_by_parent_request, + build_gi_versions_get_request, + build_gi_versions_list_by_location_request, + build_operations_list_request, + build_oracle_subscriptions_add_azure_subscriptions_request, + build_oracle_subscriptions_create_or_update_request, + build_oracle_subscriptions_delete_request, + build_oracle_subscriptions_get_request, + build_oracle_subscriptions_list_activation_links_request, + build_oracle_subscriptions_list_by_subscription_request, + build_oracle_subscriptions_list_cloud_account_details_request, + build_oracle_subscriptions_list_saas_subscription_details_request, + build_oracle_subscriptions_update_request, + build_system_versions_get_request, + build_system_versions_list_by_location_request, + build_virtual_network_addresses_create_or_update_request, + build_virtual_network_addresses_delete_request, + build_virtual_network_addresses_get_request, + build_virtual_network_addresses_list_by_parent_request, +) +from .._configuration import OracleDatabaseMgmtClientConfiguration + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 Operation + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 CloudExadataInfrastructure + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudExadataInfrastructure]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_cloud_exadata_infrastructures_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CloudExadataInfrastructure], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _create_or_update_initial( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: Union[_models.CloudExadataInfrastructure, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_exadata_infrastructures_create_or_update_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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, JSON, 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 one of the following types: + CloudExadataInfrastructure, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CloudExadataInfrastructure, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The CloudExadataInfrastructure is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + + _request = build_cloud_exadata_infrastructures_get_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CloudExadataInfrastructure, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: Union[_models.CloudExadataInfrastructureUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_exadata_infrastructures_update_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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, JSON, 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 one of the following types: + CloudExadataInfrastructureUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CloudExadataInfrastructure, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_exadata_infrastructures_delete_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @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 CloudExadataInfrastructure + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudExadataInfrastructure]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_cloud_exadata_infrastructures_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CloudExadataInfrastructure], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _add_storage_capacity_initial( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_exadata_infrastructures_add_storage_capacity_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.CloudExadataInfrastructure, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + +class ListActionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`list_actions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DbServer is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DbServer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DbServer] = kwargs.pop("cls", None) + + _request = build_db_servers_get_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + dbserverocid=dbserverocid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DbServer, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_parent( + 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 DbServer + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DbServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DbServer]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_db_servers_list_by_parent_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DbServer], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 CloudVmCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_cloud_vm_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CloudVmCluster], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _create_or_update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: Union[_models.CloudVmCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_create_or_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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, JSON, 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 one of the following types: CloudVmCluster, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudVmCluster or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The CloudVmCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.CloudVmCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + + _request = build_cloud_vm_clusters_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: Union[_models.CloudVmClusterUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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, JSON, 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 one of the following types: + CloudVmClusterUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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( + self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_vm_clusters_delete_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @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 CloudVmCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_cloud_vm_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CloudVmCluster], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _add_vms_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_add_vms_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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, JSON, 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 one of the following types: AddRemoveDbNode, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _remove_vms_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_remove_vms_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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 CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :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, JSON, 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 one of the following types: AddRemoveDbNode, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CloudVmCluster. The CloudVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + :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: JSON, + *, + 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: JSON + :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 + :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 + :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, JSON, 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 one of the following types: + PrivateIpAddressesFilter, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.PrivateIpAddressesFilter or JSON or IO[bytes] + :return: list of PrivateIpAddressProperties + :rtype: list[~azure.mgmt.oracledatabase.models.PrivateIpAddressProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_list_private_ip_addresses_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.PrivateIpAddressProperties], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_or_update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: Union[_models.VirtualNetworkAddress, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_network_addresses_create_or_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 VirtualNetworkAddress. The + VirtualNetworkAddress is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 VirtualNetworkAddress. The + VirtualNetworkAddress is compatible with MutableMapping + :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 VirtualNetworkAddress. The + VirtualNetworkAddress is compatible with MutableMapping + :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, JSON, 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 one of the following types: + VirtualNetworkAddress, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualNetworkAddress. The + VirtualNetworkAddress is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualNetworkAddress, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The VirtualNetworkAddress is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualNetworkAddress] = kwargs.pop("cls", None) + + _request = build_virtual_network_addresses_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualNetworkAddress, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, cloudvmclustername: str, virtualnetworkaddressname: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_network_addresses_delete_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @distributed_trace + def list_by_parent( + 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 VirtualNetworkAddress + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualNetworkAddress]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_virtual_network_addresses_list_by_parent_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualNetworkAddress], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SystemVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`system_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, location: str, systemversionname: str, **kwargs: Any) -> _models.SystemVersion: + """Get a SystemVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param systemversionname: SystemVersion name. Required. + :type systemversionname: str + :return: SystemVersion. The SystemVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.SystemVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SystemVersion] = kwargs.pop("cls", None) + + _request = build_system_versions_get_request( + location=location, + systemversionname=systemversionname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SystemVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.SystemVersion"]: + """List SystemVersion resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of SystemVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.SystemVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SystemVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_system_versions_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SystemVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 OracleSubscription + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OracleSubscription]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_oracle_subscriptions_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OracleSubscription], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _create_or_update_initial( + self, resource: Union[_models.OracleSubscription, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_oracle_subscriptions_create_or_update_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 OracleSubscription. The OracleSubscription + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, resource: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 OracleSubscription. The OracleSubscription + is compatible with MutableMapping + :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 OracleSubscription. The OracleSubscription + is compatible with MutableMapping + :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, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Is one of the following types: OracleSubscription, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.OracleSubscription or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OracleSubscription. The OracleSubscription + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OracleSubscription, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace_async + async def get(self, **kwargs: Any) -> _models.OracleSubscription: + """Get a OracleSubscription. + + :return: OracleSubscription. The OracleSubscription is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.OracleSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_get_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OracleSubscription, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, properties: Union[_models.OracleSubscriptionUpdate, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_oracle_subscriptions_update_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 OracleSubscription. The OracleSubscription + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, properties: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :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 OracleSubscription. The OracleSubscription + is compatible with MutableMapping + :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 OracleSubscription. The OracleSubscription + is compatible with MutableMapping + :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, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Is one of the following types: + OracleSubscriptionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns OracleSubscription. The OracleSubscription + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OracleSubscription, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_delete_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a OracleSubscription. + + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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(cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_cloud_account_details_initial(self, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_list_cloud_account_details_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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[None]: + """List Cloud Account Details. + + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._list_cloud_account_details_initial( + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_saas_subscription_details_initial(self, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_list_saas_subscription_details_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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[None]: + """List Saas Subscription Details. + + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._list_saas_subscription_details_initial( + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_list_activation_links_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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[None]: + """List Activation Links. + + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._list_activation_links_initial( + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @api_version_validation( + method_added_on="2024-06-01-preview", + params_added_on={"2024-06-01-preview": ["api_version", "subscription_id", "content_type", "accept"]}, + ) + async def _add_azure_subscriptions_initial( + self, body: Union[_models.AzureSubscriptions, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_oracle_subscriptions_add_azure_subscriptions_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_add_azure_subscriptions( + self, body: _models.AzureSubscriptions, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Add Azure Subscriptions. + + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.AzureSubscriptions + :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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_add_azure_subscriptions( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Add Azure Subscriptions. + + :param body: The content of the action request. Required. + :type body: JSON + :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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_add_azure_subscriptions( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Add Azure Subscriptions. + + :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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-06-01-preview", + params_added_on={"2024-06-01-preview": ["api_version", "subscription_id", "content_type", "accept"]}, + ) + async def begin_add_azure_subscriptions( + self, body: Union[_models.AzureSubscriptions, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Add Azure Subscriptions. + + :param body: The content of the action request. Is one of the following types: + AzureSubscriptions, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.AzureSubscriptions or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + 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._add_azure_subscriptions_initial( + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DbNode is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DbNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DbNode] = kwargs.pop("cls", None) + + _request = build_db_nodes_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DbNode, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_parent( + 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 DbNode + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DbNode]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_db_nodes_list_by_parent_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DbNode], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _action_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: Union[_models.DbNodeAction, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_db_nodes_action_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 DbNode. The DbNode is compatible with + MutableMapping + :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: JSON, + *, + 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: JSON + :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 DbNode. The DbNode is compatible with + MutableMapping + :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 DbNode. The DbNode is compatible with + MutableMapping + :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, JSON, 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 one of the following types: DbNodeAction, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.DbNodeAction or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DbNode. The DbNode is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.DbNode, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The GiVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.GiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GiVersion] = kwargs.pop("cls", None) + + _request = build_gi_versions_get_request( + location=location, + giversionname=giversionname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GiVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": ["api_version", "subscription_id", "location", "shape", "zone", "accept"] + }, + ) + def list_by_location( + self, + location: str, + *, + shape: Optional[Union[str, _models.SystemShapes]] = None, + zone: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.GiVersion"]: + """List GiVersion resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword shape: If provided, filters the results for the given shape. Known values are: + "Exadata.X9M", "Exadata.X11M", and "ExaDbXS". Default value is None. + :paramtype shape: str or ~azure.mgmt.oracledatabase.models.SystemShapes + :keyword zone: Filters the result for the given Azure Availability Zone. Default value is None. + :paramtype zone: str + :return: An iterator like instance of GiVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.GiVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GiVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_gi_versions_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + shape=shape, + zone=zone, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GiVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class GiMinorVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`gi_minor_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "location", + "giversionname", + "shape_family", + "zone", + "accept", + ] + }, + ) + def list_by_parent( + self, + location: str, + giversionname: str, + *, + shape_family: Optional[Union[str, _models.ShapeFamily]] = None, + zone: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.GiMinorVersion"]: + """List GiMinorVersion resources by GiVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param giversionname: GiVersion name. Required. + :type giversionname: str + :keyword shape_family: If provided, filters the results to the set of database versions which + are supported for the given shape family. Known values are: "EXADATA" and "EXADB_XS". Default + value is None. + :paramtype shape_family: str or ~azure.mgmt.oracledatabase.models.ShapeFamily + :keyword zone: Filters the result for the given Azure Availability Zone. Default value is None. + :paramtype zone: str + :return: An iterator like instance of GiMinorVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.GiMinorVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GiMinorVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_gi_minor_versions_list_by_parent_request( + location=location, + giversionname=giversionname, + subscription_id=self._config.subscription_id, + shape_family=shape_family, + zone=zone, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GiMinorVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "location", + "giversionname", + "gi_minor_version_name", + "accept", + ] + }, + ) + async def get( + self, location: str, giversionname: str, gi_minor_version_name: str, **kwargs: Any + ) -> _models.GiMinorVersion: + """Get a GiMinorVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param giversionname: GiVersion name. Required. + :type giversionname: str + :param gi_minor_version_name: The name of the GiMinorVersion. Required. + :type gi_minor_version_name: str + :return: GiMinorVersion. The GiMinorVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.GiMinorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GiMinorVersion] = kwargs.pop("cls", None) + + _request = build_gi_minor_versions_get_request( + location=location, + giversionname=giversionname, + gi_minor_version_name=gi_minor_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GiMinorVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DbSystemShape is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DbSystemShape + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DbSystemShape] = kwargs.pop("cls", None) + + _request = build_db_system_shapes_get_request( + location=location, + dbsystemshapename=dbsystemshapename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DbSystemShape, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "location", "zone", "accept"]}, + ) + def list_by_location( + self, location: str, *, zone: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.DbSystemShape"]: + """List DbSystemShape resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword zone: Filters the result for the given Azure Availability Zone. Default value is None. + :paramtype zone: str + :return: An iterator like instance of DbSystemShape + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DbSystemShape] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DbSystemShape]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_db_system_shapes_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + zone=zone, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DbSystemShape], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DnsPrivateView is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DnsPrivateView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DnsPrivateView] = kwargs.pop("cls", None) + + _request = build_dns_private_views_get_request( + location=location, + dnsprivateviewocid=dnsprivateviewocid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DnsPrivateView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.DnsPrivateView"]: + """List DnsPrivateView resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of DnsPrivateView + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DnsPrivateView] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DnsPrivateView]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_dns_private_views_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DnsPrivateView], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DnsPrivateZone is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DnsPrivateZone + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DnsPrivateZone] = kwargs.pop("cls", None) + + _request = build_dns_private_zones_get_request( + location=location, + dnsprivatezonename=dnsprivatezonename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DnsPrivateZone, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.DnsPrivateZone"]: + """List DnsPrivateZone resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of DnsPrivateZone + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DnsPrivateZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DnsPrivateZone]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_dns_private_zones_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DnsPrivateZone], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class FlexComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`flex_components` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2025-01-01-preview", + params_added_on={ + "2025-01-01-preview": ["api_version", "subscription_id", "location", "flex_component_name", "accept"] + }, + ) + async def get(self, location: str, flex_component_name: str, **kwargs: Any) -> _models.FlexComponent: + """Get a FlexComponent. + + :param location: The name of the Azure region. Required. + :type location: str + :param flex_component_name: The name of the FlexComponent. Required. + :type flex_component_name: str + :return: FlexComponent. The FlexComponent is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.FlexComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FlexComponent] = kwargs.pop("cls", None) + + _request = build_flex_components_get_request( + location=location, + flex_component_name=flex_component_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FlexComponent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2025-01-01-preview", + params_added_on={"2025-01-01-preview": ["api_version", "subscription_id", "location", "shape", "accept"]}, + ) + def list_by_parent( + self, location: str, *, shape: Optional[Union[str, _models.SystemShapes]] = None, **kwargs: Any + ) -> AsyncIterable["_models.FlexComponent"]: + """List FlexComponent resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword shape: If provided, filters the results for the given shape. Known values are: + "Exadata.X9M", "Exadata.X11M", and "ExaDbXS". Default value is None. + :paramtype shape: str or ~azure.mgmt.oracledatabase.models.SystemShapes + :return: An iterator like instance of FlexComponent + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.FlexComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FlexComponent]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_flex_components_list_by_parent_request( + location=location, + subscription_id=self._config.subscription_id, + shape=shape, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FlexComponent], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 AutonomousDatabase + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_databases_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDatabase], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _create_or_update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: Union[_models.AutonomousDatabase, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_create_or_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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, JSON, 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 one of the following types: AutonomousDatabase, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabase or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The AutonomousDatabase is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + + _request = build_autonomous_databases_get_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: Union[_models.AutonomousDatabaseUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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, JSON, 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 one of the following types: + AutonomousDatabaseUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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( + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_autonomous_databases_delete_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @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 AutonomousDatabase + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_databases_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDatabase], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _switchover_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_switchover_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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, JSON, 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 one of the following types: PeerDbDetails, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _failover_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_failover_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :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, JSON, 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 one of the following types: PeerDbDetails, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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. The AutonomousDatabaseWalletFile is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def generate_wallet( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: JSON, + *, + 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutonomousDatabaseWalletFile. The AutonomousDatabaseWalletFile is compatible with + MutableMapping + :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. The AutonomousDatabaseWalletFile is compatible with + MutableMapping + :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, JSON, 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 one of the following types: + GenerateAutonomousDatabaseWalletDetails, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.GenerateAutonomousDatabaseWalletDetails or JSON + or IO[bytes] + :return: AutonomousDatabaseWalletFile. The AutonomousDatabaseWalletFile is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_generate_wallet_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabaseWalletFile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _restore_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.RestoreAutonomousDatabaseDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_restore_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_restore( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.RestoreAutonomousDatabaseDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Restores an Autonomous Database based on the provided request parameters. + + :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.RestoreAutonomousDatabaseDetails + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restore( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Restores an Autonomous Database based on the provided request parameters. + + :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: JSON + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restore( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Restores an Autonomous Database based on the provided request parameters. + + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_restore( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.RestoreAutonomousDatabaseDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Restores an Autonomous Database based on the provided request parameters. + + :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 one of the following types: + RestoreAutonomousDatabaseDetails, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.RestoreAutonomousDatabaseDetails or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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._restore_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _shrink_initial( + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_autonomous_databases_shrink_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_shrink( + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """This operation shrinks the current allocated storage down to the current actual used data + storage. + + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._shrink_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @api_version_validation( + method_added_on="2024-10-01-preview", + params_added_on={ + "2024-10-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "autonomousdatabasename", + "content_type", + "accept", + ] + }, + ) + async def _change_disaster_recovery_configuration_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.DisasterRecoveryConfigurationDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_change_disaster_recovery_configuration_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_change_disaster_recovery_configuration( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.DisasterRecoveryConfigurationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform ChangeDisasterRecoveryConfiguration 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.DisasterRecoveryConfigurationDetails + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_change_disaster_recovery_configuration( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform ChangeDisasterRecoveryConfiguration 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_change_disaster_recovery_configuration( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform ChangeDisasterRecoveryConfiguration 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 AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-10-01-preview", + params_added_on={ + "2024-10-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "autonomousdatabasename", + "content_type", + "accept", + ] + }, + ) + async def begin_change_disaster_recovery_configuration( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.DisasterRecoveryConfigurationDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform ChangeDisasterRecoveryConfiguration 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 one of the following types: + DisasterRecoveryConfigurationDetails, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.DisasterRecoveryConfigurationDetails or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns AutonomousDatabase. The AutonomousDatabase + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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._change_disaster_recovery_configuration_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_or_update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: Union[_models.AutonomousDatabaseBackup, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_database_backups_create_or_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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, JSON, 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 one of the following types: + AutonomousDatabaseBackup, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AutonomousDatabaseBackup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The AutonomousDatabaseBackup is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + + _request = build_autonomous_database_backups_get_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabaseBackup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_autonomous_database_backups_delete_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: Union[_models.AutonomousDatabaseBackup, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_database_backups_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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.AutonomousDatabaseBackup, + *, + 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.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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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.AutonomousDatabaseBackup, JSON, 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 one of the following types: + AutonomousDatabaseBackup, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AutonomousDatabaseBackup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace + def list_by_parent( + 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 AutonomousDatabaseBackup + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabaseBackup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_database_backups_list_by_parent_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDatabaseBackup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The AutonomousDatabaseCharacterSet is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDatabaseCharacterSet] = kwargs.pop("cls", None) + + _request = build_autonomous_database_character_sets_get_request( + location=location, + adbscharsetname=adbscharsetname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabaseCharacterSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AutonomousDatabaseCharacterSet"]: + """List AutonomousDatabaseCharacterSet resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of AutonomousDatabaseCharacterSet + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabaseCharacterSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_database_character_sets_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDatabaseCharacterSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The AutonomousDatabaseNationalCharacterSet is + compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDatabaseNationalCharacterSet] = kwargs.pop("cls", None) + + _request = build_autonomous_database_national_character_sets_get_request( + location=location, + adbsncharsetname=adbsncharsetname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabaseNationalCharacterSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location( + self, location: str, **kwargs: Any + ) -> AsyncIterable["_models.AutonomousDatabaseNationalCharacterSet"]: + """List AutonomousDatabaseNationalCharacterSet resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of AutonomousDatabaseNationalCharacterSet + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabaseNationalCharacterSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_database_national_character_sets_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AutonomousDatabaseNationalCharacterSet], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The AutonomousDbVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDbVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDbVersion] = kwargs.pop("cls", None) + + _request = build_autonomous_database_versions_get_request( + location=location, + autonomousdbversionsname=autonomousdbversionsname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDbVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AutonomousDbVersion"]: + """List AutonomousDbVersion resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of AutonomousDbVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDbVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDbVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_database_versions_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDbVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ExadbVmClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`exadb_vm_clusters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "accept"]}, + ) + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ExadbVmCluster"]: + """List ExadbVmCluster resources by subscription ID. + + :return: An iterator like instance of ExadbVmCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExadbVmCluster]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exadb_vm_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExadbVmCluster], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + async def _create_or_update_initial( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + resource: Union[_models.ExadbVmCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exadb_vm_clusters_create_or_update_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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, + exadb_vm_cluster_name: str, + resource: _models.ExadbVmCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """Create a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.ExadbVmCluster + :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 ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """Create a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """Create a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: 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 ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + async def begin_create_or_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + resource: Union[_models.ExadbVmCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """Create a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param resource: Resource create parameters. Is one of the following types: ExadbVmCluster, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.ExadbVmCluster or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExadbVmCluster] = 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, + exadb_vm_cluster_name=exadb_vm_cluster_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ExadbVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ExadbVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ExadbVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "accept", + ] + }, + ) + async def get(self, resource_group_name: str, exadb_vm_cluster_name: str, **kwargs: Any) -> _models.ExadbVmCluster: + """Get a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :return: ExadbVmCluster. The ExadbVmCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.ExadbVmCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ExadbVmCluster] = kwargs.pop("cls", None) + + _request = build_exadb_vm_clusters_get_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ExadbVmCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + async def _update_initial( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + properties: Union[_models.ExadbVmClusterUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exadb_vm_clusters_update_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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, + exadb_vm_cluster_name: str, + properties: _models.ExadbVmClusterUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """Update a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.ExadbVmClusterUpdate + :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 ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """Update a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :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 ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """Update a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: 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 ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + async def begin_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + properties: Union[_models.ExadbVmClusterUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """Update a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param properties: The resource properties to be updated. Is one of the following types: + ExadbVmClusterUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.ExadbVmClusterUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExadbVmCluster] = 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, + exadb_vm_cluster_name=exadb_vm_cluster_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ExadbVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ExadbVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ExadbVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "accept", + ] + }, + ) + async def _delete_initial( + self, resource_group_name: str, exadb_vm_cluster_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_exadb_vm_clusters_delete_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "accept", + ] + }, + ) + async def begin_delete( + self, resource_group_name: str, exadb_vm_cluster_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "resource_group_name", "accept"]}, + ) + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExadbVmCluster"]: + """List ExadbVmCluster 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 ExadbVmCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExadbVmCluster]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exadb_vm_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExadbVmCluster], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + async def _remove_vms_initial( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + body: Union[_models.RemoveVirtualMachineFromExadbVmClusterDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exadb_vm_clusters_remove_vms_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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, + exadb_vm_cluster_name: str, + body: _models.RemoveVirtualMachineFromExadbVmClusterDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.RemoveVirtualMachineFromExadbVmClusterDetails + :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 ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_remove_vms( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param body: The content of the action request. Required. + :type body: JSON + :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 ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_remove_vms( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: 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 ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + async def begin_remove_vms( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + body: Union[_models.RemoveVirtualMachineFromExadbVmClusterDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExadbVmCluster]: + """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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param body: The content of the action request. Is one of the following types: + RemoveVirtualMachineFromExadbVmClusterDetails, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.RemoveVirtualMachineFromExadbVmClusterDetails or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ExadbVmCluster. The ExadbVmCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExadbVmCluster] = 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, + exadb_vm_cluster_name=exadb_vm_cluster_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ExadbVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ExadbVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ExadbVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class ExascaleDbNodesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`exascale_db_nodes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "exascale_db_node_name", + "accept", + ] + }, + ) + async def get( + self, resource_group_name: str, exadb_vm_cluster_name: str, exascale_db_node_name: str, **kwargs: Any + ) -> _models.ExascaleDbNode: + """Get a ExascaleDbNode. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: str + :return: ExascaleDbNode. The ExascaleDbNode is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.ExascaleDbNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ExascaleDbNode] = kwargs.pop("cls", None) + + _request = build_exascale_db_nodes_get_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + exascale_db_node_name=exascale_db_node_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ExascaleDbNode, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "accept", + ] + }, + ) + def list_by_parent( + self, resource_group_name: str, exadb_vm_cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExascaleDbNode"]: + """List ExascaleDbNode resources by ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :return: An iterator like instance of ExascaleDbNode + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.ExascaleDbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExascaleDbNode]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exascale_db_nodes_list_by_parent_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExascaleDbNode], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "exascale_db_node_name", + "content_type", + "accept", + ] + }, + ) + async def _action_initial( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: Union[_models.DbNodeAction, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exascale_db_nodes_action_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + exascale_db_node_name=exascale_db_node_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: _models.DbNodeAction, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DbActionResponse]: + """VM actions on DbNode of ExadbVmCluster 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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: 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 DbActionResponse. The DbActionResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.DbActionResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_action( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DbActionResponse]: + """VM actions on DbNode of ExadbVmCluster 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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: str + :param body: The content of the action request. Required. + :type body: JSON + :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 DbActionResponse. The DbActionResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.DbActionResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_action( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DbActionResponse]: + """VM actions on DbNode of ExadbVmCluster 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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: 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 DbActionResponse. The DbActionResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.DbActionResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "exascale_db_node_name", + "content_type", + "accept", + ] + }, + ) + async def begin_action( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: Union[_models.DbNodeAction, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DbActionResponse]: + """VM actions on DbNode of ExadbVmCluster 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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: str + :param body: The content of the action request. Is one of the following types: DbNodeAction, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.DbNodeAction or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DbActionResponse. The DbActionResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.DbActionResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DbActionResponse] = 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, + exadb_vm_cluster_name=exadb_vm_cluster_name, + exascale_db_node_name=exascale_db_node_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.DbActionResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DbActionResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DbActionResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class ExascaleDbStorageVaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`exascale_db_storage_vaults` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "accept", + ] + }, + ) + async def get( + self, resource_group_name: str, exascale_db_storage_vault_name: str, **kwargs: Any + ) -> _models.ExascaleDbStorageVault: + """Get a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :return: ExascaleDbStorageVault. The ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ExascaleDbStorageVault] = kwargs.pop("cls", None) + + _request = build_exascale_db_storage_vaults_get_request( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ExascaleDbStorageVault, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "content_type", + "accept", + ] + }, + ) + async def _create_initial( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: Union[_models.ExascaleDbStorageVault, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exascale_db_storage_vaults_create_request( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: _models.ExascaleDbStorageVault, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExascaleDbStorageVault]: + """Create a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault + :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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExascaleDbStorageVault]: + """Create a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExascaleDbStorageVault]: + """Create a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: 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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "content_type", + "accept", + ] + }, + ) + async def begin_create( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: Union[_models.ExascaleDbStorageVault, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExascaleDbStorageVault]: + """Create a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param resource: Resource create parameters. Is one of the following types: + ExascaleDbStorageVault, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExascaleDbStorageVault] = 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_initial( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ExascaleDbStorageVault, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ExascaleDbStorageVault].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ExascaleDbStorageVault]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "content_type", + "accept", + ] + }, + ) + async def _update_initial( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + properties: Union[_models.ExascaleDbStorageVaultTagsUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exascale_db_storage_vaults_update_request( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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, + exascale_db_storage_vault_name: str, + properties: _models.ExascaleDbStorageVaultTagsUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExascaleDbStorageVault]: + """Update a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVaultTagsUpdate + :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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExascaleDbStorageVault]: + """Update a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExascaleDbStorageVault]: + """Update a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: 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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "content_type", + "accept", + ] + }, + ) + async def begin_update( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + properties: Union[_models.ExascaleDbStorageVaultTagsUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExascaleDbStorageVault]: + """Update a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param properties: The resource properties to be updated. Is one of the following types: + ExascaleDbStorageVaultTagsUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVaultTagsUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExascaleDbStorageVault] = 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, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ExascaleDbStorageVault, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ExascaleDbStorageVault].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ExascaleDbStorageVault]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "accept", + ] + }, + ) + async def _delete_initial( + self, resource_group_name: str, exascale_db_storage_vault_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_exascale_db_storage_vaults_delete_request( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "accept", + ] + }, + ) + async def begin_delete( + self, resource_group_name: str, exascale_db_storage_vault_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "resource_group_name", "accept"]}, + ) + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExascaleDbStorageVault"]: + """List ExascaleDbStorageVault 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 ExascaleDbStorageVault + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExascaleDbStorageVault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exascale_db_storage_vaults_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExascaleDbStorageVault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "accept"]}, + ) + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ExascaleDbStorageVault"]: + """List ExascaleDbStorageVault resources by subscription ID. + + :return: An iterator like instance of ExascaleDbStorageVault + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExascaleDbStorageVault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exascale_db_storage_vaults_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExascaleDbStorageVault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/oracledatabase/arm-oracledatabase/aio/operations/_patch.py b/sdk/oracledatabase/arm-oracledatabase/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/oracledatabase/arm-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/oracledatabase/arm-oracledatabase/apiview-properties.json b/sdk/oracledatabase/arm-oracledatabase/apiview-properties.json new file mode 100644 index 000000000000..a54a61493626 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/apiview-properties.json @@ -0,0 +1,258 @@ +{ + "CrossLanguagePackageId": "Oracle.Database", + "CrossLanguageDefinitionId": { + "azure.mgmt.oracledatabase.models.AddRemoveDbNode": "Oracle.Database.AddRemoveDbNode", + "azure.mgmt.oracledatabase.models.AllConnectionStringType": "Oracle.Database.AllConnectionStringType", + "azure.mgmt.oracledatabase.models.ApexDetailsType": "Oracle.Database.ApexDetailsType", + "azure.mgmt.oracledatabase.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.oracledatabase.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.oracledatabase.models.AutonomousDatabase": "Oracle.Database.AutonomousDatabase", + "azure.mgmt.oracledatabase.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup": "Oracle.Database.AutonomousDatabaseBackup", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupProperties": "Oracle.Database.AutonomousDatabaseBackupProperties", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseBaseProperties": "Oracle.Database.AutonomousDatabaseBaseProperties", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet": "Oracle.Database.AutonomousDatabaseCharacterSet", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSetProperties": "Oracle.Database.AutonomousDatabaseCharacterSetProperties", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseCloneProperties": "Oracle.Database.AutonomousDatabaseCloneProperties", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseCrossRegionDisasterRecoveryProperties": "Oracle.Database.AutonomousDatabaseCrossRegionDisasterRecoveryProperties", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseFromBackupTimestampProperties": "Oracle.Database.AutonomousDatabaseFromBackupTimestampProperties", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet": "Oracle.Database.AutonomousDatabaseNationalCharacterSet", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSetProperties": "Oracle.Database.AutonomousDatabaseNationalCharacterSetProperties", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseProperties": "Oracle.Database.AutonomousDatabaseProperties", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseStandbySummary": "Oracle.Database.AutonomousDatabaseStandbySummary", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile": "Oracle.Database.AutonomousDatabaseWalletFile", + "azure.mgmt.oracledatabase.models.AutonomousDbVersion": "Oracle.Database.AutonomousDbVersion", + "azure.mgmt.oracledatabase.models.AutonomousDbVersionProperties": "Oracle.Database.AutonomousDbVersionProperties", + "azure.mgmt.oracledatabase.models.AzureSubscriptions": "Oracle.Database.AzureSubscriptions", + "azure.mgmt.oracledatabase.models.CloudExadataInfrastructure": "Oracle.Database.CloudExadataInfrastructure", + "azure.mgmt.oracledatabase.models.CloudExadataInfrastructureProperties": "Oracle.Database.CloudExadataInfrastructureProperties", + "azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.oracledatabase.models.CloudVmCluster": "Oracle.Database.CloudVmCluster", + "azure.mgmt.oracledatabase.models.CloudVmClusterProperties": "Oracle.Database.CloudVmClusterProperties", + "azure.mgmt.oracledatabase.models.CloudVmClusterUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.oracledatabase.models.CloudVmClusterUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.oracledatabase.models.ConnectionStringType": "Oracle.Database.ConnectionStringType", + "azure.mgmt.oracledatabase.models.ConnectionUrlType": "Oracle.Database.ConnectionUrlType", + "azure.mgmt.oracledatabase.models.CustomerContact": "Oracle.Database.CustomerContact", + "azure.mgmt.oracledatabase.models.DataCollectionOptions": "Oracle.Database.DataCollectionOptions", + "azure.mgmt.oracledatabase.models.DayOfWeek": "Oracle.Database.DayOfWeek", + "azure.mgmt.oracledatabase.models.DbActionResponse": "Oracle.Database.DbActionResponse", + "azure.mgmt.oracledatabase.models.DbIormConfig": "Oracle.Database.DbIormConfig", + "azure.mgmt.oracledatabase.models.DbNode": "Oracle.Database.DbNode", + "azure.mgmt.oracledatabase.models.DbNodeAction": "Oracle.Database.DbNodeAction", + "azure.mgmt.oracledatabase.models.DbNodeDetails": "Oracle.Database.DbNodeDetails", + "azure.mgmt.oracledatabase.models.DbNodeProperties": "Oracle.Database.DbNodeProperties", + "azure.mgmt.oracledatabase.models.DbServer": "Oracle.Database.DbServer", + "azure.mgmt.oracledatabase.models.DbServerPatchingDetails": "Oracle.Database.DbServerPatchingDetails", + "azure.mgmt.oracledatabase.models.DbServerProperties": "Oracle.Database.DbServerProperties", + "azure.mgmt.oracledatabase.models.DbSystemShape": "Oracle.Database.DbSystemShape", + "azure.mgmt.oracledatabase.models.DbSystemShapeProperties": "Oracle.Database.DbSystemShapeProperties", + "azure.mgmt.oracledatabase.models.DefinedFileSystemConfiguration": "Oracle.Database.DefinedFileSystemConfiguration", + "azure.mgmt.oracledatabase.models.DisasterRecoveryConfigurationDetails": "Oracle.Database.DisasterRecoveryConfigurationDetails", + "azure.mgmt.oracledatabase.models.DnsPrivateView": "Oracle.Database.DnsPrivateView", + "azure.mgmt.oracledatabase.models.DnsPrivateViewProperties": "Oracle.Database.DnsPrivateViewProperties", + "azure.mgmt.oracledatabase.models.DnsPrivateZone": "Oracle.Database.DnsPrivateZone", + "azure.mgmt.oracledatabase.models.DnsPrivateZoneProperties": "Oracle.Database.DnsPrivateZoneProperties", + "azure.mgmt.oracledatabase.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.oracledatabase.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.oracledatabase.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.oracledatabase.models.EstimatedPatchingTime": "Oracle.Database.EstimatedPatchingTime", + "azure.mgmt.oracledatabase.models.ExadataIormConfig": "Oracle.Database.ExadataIormConfig", + "azure.mgmt.oracledatabase.models.ExadbVmCluster": "Oracle.Database.ExadbVmCluster", + "azure.mgmt.oracledatabase.models.ExadbVmClusterProperties": "Oracle.Database.ExadbVmClusterProperties", + "azure.mgmt.oracledatabase.models.ExadbVmClusterStorageDetails": "Oracle.Database.ExadbVmClusterStorageDetails", + "azure.mgmt.oracledatabase.models.ExadbVmClusterUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.oracledatabase.models.ExadbVmClusterUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.oracledatabase.models.ExascaleDbNode": "Oracle.Database.ExascaleDbNode", + "azure.mgmt.oracledatabase.models.ExascaleDbNodeProperties": "Oracle.Database.ExascaleDbNodeProperties", + "azure.mgmt.oracledatabase.models.ExascaleDbStorageDetails": "Oracle.Database.ExascaleDbStorageDetails", + "azure.mgmt.oracledatabase.models.ExascaleDbStorageInputDetails": "Oracle.Database.ExascaleDbStorageInputDetails", + "azure.mgmt.oracledatabase.models.ExascaleDbStorageVault": "Oracle.Database.ExascaleDbStorageVault", + "azure.mgmt.oracledatabase.models.ExascaleDbStorageVaultProperties": "Oracle.Database.ExascaleDbStorageVaultProperties", + "azure.mgmt.oracledatabase.models.ExascaleDbStorageVaultTagsUpdate": "Azure.ResourceManager.Foundations.TagsUpdateModel", + "azure.mgmt.oracledatabase.models.FileSystemConfigurationDetails": "Oracle.Database.FileSystemConfigurationDetails", + "azure.mgmt.oracledatabase.models.FlexComponent": "Oracle.Database.FlexComponent", + "azure.mgmt.oracledatabase.models.FlexComponentProperties": "Oracle.Database.FlexComponentProperties", + "azure.mgmt.oracledatabase.models.GenerateAutonomousDatabaseWalletDetails": "Oracle.Database.GenerateAutonomousDatabaseWalletDetails", + "azure.mgmt.oracledatabase.models.GiMinorVersion": "Oracle.Database.GiMinorVersion", + "azure.mgmt.oracledatabase.models.GiMinorVersionProperties": "Oracle.Database.GiMinorVersionProperties", + "azure.mgmt.oracledatabase.models.GiVersion": "Oracle.Database.GiVersion", + "azure.mgmt.oracledatabase.models.GiVersionProperties": "Oracle.Database.GiVersionProperties", + "azure.mgmt.oracledatabase.models.LongTermBackUpScheduleDetails": "Oracle.Database.LongTermBackUpScheduleDetails", + "azure.mgmt.oracledatabase.models.MaintenanceWindow": "Oracle.Database.MaintenanceWindow", + "azure.mgmt.oracledatabase.models.Month": "Oracle.Database.Month", + "azure.mgmt.oracledatabase.models.NsgCidr": "Oracle.Database.NsgCidr", + "azure.mgmt.oracledatabase.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.oracledatabase.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.oracledatabase.models.OracleSubscription": "Oracle.Database.OracleSubscription", + "azure.mgmt.oracledatabase.models.OracleSubscriptionProperties": "Oracle.Database.OracleSubscriptionProperties", + "azure.mgmt.oracledatabase.models.OracleSubscriptionUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.oracledatabase.models.OracleSubscriptionUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.oracledatabase.models.PeerDbDetails": "Oracle.Database.PeerDbDetails", + "azure.mgmt.oracledatabase.models.Plan": "Azure.ResourceManager.CommonTypes.Plan", + "azure.mgmt.oracledatabase.models.PlanUpdate": "Oracle.Database.PlanUpdate", + "azure.mgmt.oracledatabase.models.PortRange": "Oracle.Database.PortRange", + "azure.mgmt.oracledatabase.models.PrivateIpAddressesFilter": "Oracle.Database.PrivateIpAddressesFilter", + "azure.mgmt.oracledatabase.models.PrivateIpAddressProperties": "Oracle.Database.PrivateIpAddressProperties", + "azure.mgmt.oracledatabase.models.ProfileType": "Oracle.Database.ProfileType", + "azure.mgmt.oracledatabase.models.RemoveVirtualMachineFromExadbVmClusterDetails": "Oracle.Database.RemoveVirtualMachineFromExadbVmClusterDetails", + "azure.mgmt.oracledatabase.models.RestoreAutonomousDatabaseDetails": "Oracle.Database.RestoreAutonomousDatabaseDetails", + "azure.mgmt.oracledatabase.models.ScheduledOperationsType": "Oracle.Database.ScheduledOperationsType", + "azure.mgmt.oracledatabase.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.oracledatabase.models.SystemVersion": "Oracle.Database.SystemVersion", + "azure.mgmt.oracledatabase.models.SystemVersionProperties": "Oracle.Database.SystemVersionProperties", + "azure.mgmt.oracledatabase.models.VirtualNetworkAddress": "Oracle.Database.VirtualNetworkAddress", + "azure.mgmt.oracledatabase.models.VirtualNetworkAddressProperties": "Oracle.Database.VirtualNetworkAddressProperties", + "azure.mgmt.oracledatabase.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.oracledatabase.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.oracledatabase.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.oracledatabase.models.Preference": "Oracle.Database.Preference", + "azure.mgmt.oracledatabase.models.MonthName": "Oracle.Database.MonthName", + "azure.mgmt.oracledatabase.models.DayOfWeekName": "Oracle.Database.DayOfWeekName", + "azure.mgmt.oracledatabase.models.PatchingMode": "Oracle.Database.PatchingMode", + "azure.mgmt.oracledatabase.models.AzureResourceProvisioningState": "Oracle.Database.AzureResourceProvisioningState", + "azure.mgmt.oracledatabase.models.CloudExadataInfrastructureLifecycleState": "Oracle.Database.CloudExadataInfrastructureLifecycleState", + "azure.mgmt.oracledatabase.models.ComputeModel": "Oracle.Database.ComputeModel", + "azure.mgmt.oracledatabase.models.DbServerPatchingStatus": "Oracle.Database.DbServerPatchingStatus", + "azure.mgmt.oracledatabase.models.DbServerProvisioningState": "Oracle.Database.DbServerProvisioningState", + "azure.mgmt.oracledatabase.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", + "azure.mgmt.oracledatabase.models.LicenseModel": "Oracle.Database.LicenseModel", + "azure.mgmt.oracledatabase.models.DiskRedundancy": "Oracle.Database.DiskRedundancy", + "azure.mgmt.oracledatabase.models.CloudVmClusterLifecycleState": "Oracle.Database.CloudVmClusterLifecycleState", + "azure.mgmt.oracledatabase.models.IormLifecycleState": "Oracle.Database.IormLifecycleState", + "azure.mgmt.oracledatabase.models.Objective": "Oracle.Database.Objective", + "azure.mgmt.oracledatabase.models.VirtualNetworkAddressLifecycleState": "Oracle.Database.VirtualNetworkAddressLifecycleState", + "azure.mgmt.oracledatabase.models.OracleSubscriptionProvisioningState": "Oracle.Database.OracleSubscriptionProvisioningState", + "azure.mgmt.oracledatabase.models.CloudAccountProvisioningState": "Oracle.Database.CloudAccountProvisioningState", + "azure.mgmt.oracledatabase.models.Intent": "Oracle.Database.Intent", + "azure.mgmt.oracledatabase.models.AddSubscriptionOperationState": "Oracle.Database.AddSubscriptionOperationState", + "azure.mgmt.oracledatabase.models.DbNodeProvisioningState": "Oracle.Database.DbNodeProvisioningState", + "azure.mgmt.oracledatabase.models.DbNodeMaintenanceType": "Oracle.Database.DbNodeMaintenanceType", + "azure.mgmt.oracledatabase.models.DbNodeActionEnum": "Oracle.Database.DbNodeActionEnum", + "azure.mgmt.oracledatabase.models.SystemShapes": "Oracle.Database.SystemShapes", + "azure.mgmt.oracledatabase.models.ShapeFamily": "Oracle.Database.ShapeFamily", + "azure.mgmt.oracledatabase.models.DnsPrivateViewsLifecycleState": "Oracle.Database.DnsPrivateViewsLifecycleState", + "azure.mgmt.oracledatabase.models.DnsPrivateZonesLifecycleState": "Oracle.Database.DnsPrivateZonesLifecycleState", + "azure.mgmt.oracledatabase.models.ZoneType": "Oracle.Database.ZoneType", + "azure.mgmt.oracledatabase.models.HardwareType": "Oracle.Database.HardwareType", + "azure.mgmt.oracledatabase.models.DataBaseType": "Oracle.Database.DataBaseType", + "azure.mgmt.oracledatabase.models.AutonomousMaintenanceScheduleType": "Oracle.Database.AutonomousMaintenanceScheduleType", + "azure.mgmt.oracledatabase.models.WorkloadType": "Oracle.Database.WorkloadType", + "azure.mgmt.oracledatabase.models.DisasterRecoveryType": "Oracle.Database.DisasterRecoveryType", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseLifecycleState": "Oracle.Database.AutonomousDatabaseLifecycleState", + "azure.mgmt.oracledatabase.models.ConsumerGroup": "Oracle.Database.ConsumerGroup", + "azure.mgmt.oracledatabase.models.HostFormatType": "Oracle.Database.HostFormatType", + "azure.mgmt.oracledatabase.models.ProtocolType": "Oracle.Database.ProtocolType", + "azure.mgmt.oracledatabase.models.SessionModeType": "Oracle.Database.SessionModeType", + "azure.mgmt.oracledatabase.models.SyntaxFormatType": "Oracle.Database.SyntaxFormatType", + "azure.mgmt.oracledatabase.models.TlsAuthenticationType": "Oracle.Database.TlsAuthenticationType", + "azure.mgmt.oracledatabase.models.DataSafeStatusType": "Oracle.Database.DataSafeStatusType", + "azure.mgmt.oracledatabase.models.DatabaseEditionType": "Oracle.Database.DatabaseEditionType", + "azure.mgmt.oracledatabase.models.RepeatCadenceType": "Oracle.Database.RepeatCadenceType", + "azure.mgmt.oracledatabase.models.OpenModeType": "Oracle.Database.OpenModeType", + "azure.mgmt.oracledatabase.models.OperationsInsightsStatusType": "Oracle.Database.OperationsInsightsStatusType", + "azure.mgmt.oracledatabase.models.PermissionLevelType": "Oracle.Database.PermissionLevelType", + "azure.mgmt.oracledatabase.models.RoleType": "Oracle.Database.RoleType", + "azure.mgmt.oracledatabase.models.SourceType": "Oracle.Database.SourceType", + "azure.mgmt.oracledatabase.models.CloneType": "Oracle.Database.CloneType", + "azure.mgmt.oracledatabase.models.RefreshableModelType": "Oracle.Database.RefreshableModelType", + "azure.mgmt.oracledatabase.models.RefreshableStatusType": "Oracle.Database.RefreshableStatusType", + "azure.mgmt.oracledatabase.models.GenerateType": "Oracle.Database.GenerateType", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupLifecycleState": "Oracle.Database.AutonomousDatabaseBackupLifecycleState", + "azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupType": "Oracle.Database.AutonomousDatabaseBackupType", + "azure.mgmt.oracledatabase.models.ExadbVmClusterLifecycleState": "Oracle.Database.ExadbVmClusterLifecycleState", + "azure.mgmt.oracledatabase.models.GridImageType": "Oracle.Database.GridImageType", + "azure.mgmt.oracledatabase.models.ExascaleDbStorageVaultLifecycleState": "Oracle.Database.ExascaleDbStorageVaultLifecycleState", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_exadata_infrastructures.list_by_subscription": "Azure.ResourceManager.CloudExadataInfrastructures.listBySubscription", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_exadata_infrastructures.begin_create_or_update": "Azure.ResourceManager.CloudExadataInfrastructures.createOrUpdate", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_exadata_infrastructures.get": "Azure.ResourceManager.CloudExadataInfrastructures.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_exadata_infrastructures.begin_update": "Azure.ResourceManager.CloudExadataInfrastructures.update", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_exadata_infrastructures.begin_delete": "Azure.ResourceManager.CloudExadataInfrastructures.delete", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_exadata_infrastructures.list_by_resource_group": "Oracle.Database.CloudExadataInfrastructures.listByResourceGroup", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_exadata_infrastructures.begin_add_storage_capacity": "Oracle.Database.CloudExadataInfrastructures.addStorageCapacity", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.db_servers.get": "Oracle.Database.DbServers.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.db_servers.list_by_parent": "Oracle.Database.DbServers.listByParent", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_vm_clusters.list_by_subscription": "Azure.ResourceManager.CloudVmClusters.listBySubscription", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_vm_clusters.begin_create_or_update": "Azure.ResourceManager.CloudVmClusters.createOrUpdate", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_vm_clusters.get": "Azure.ResourceManager.CloudVmClusters.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_vm_clusters.begin_update": "Azure.ResourceManager.CloudVmClusters.update", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_vm_clusters.begin_delete": "Azure.ResourceManager.CloudVmClusters.delete", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_vm_clusters.list_by_resource_group": "Oracle.Database.CloudVmClusters.listByResourceGroup", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_vm_clusters.begin_add_vms": "Oracle.Database.CloudVmClusters.addVms", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_vm_clusters.begin_remove_vms": "Oracle.Database.CloudVmClusters.removeVms", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.cloud_vm_clusters.list_private_ip_addresses": "Oracle.Database.CloudVmClusters.listPrivateIpAddresses", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.virtual_network_addresses.begin_create_or_update": "Azure.ResourceManager.VirtualNetworkAddresses.createOrUpdate", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.virtual_network_addresses.get": "Azure.ResourceManager.VirtualNetworkAddresses.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.virtual_network_addresses.begin_delete": "Azure.ResourceManager.VirtualNetworkAddresses.delete", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.virtual_network_addresses.list_by_parent": "Oracle.Database.VirtualNetworkAddresses.listByParent", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.system_versions.get": "Oracle.Database.SystemVersions.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.system_versions.list_by_location": "Oracle.Database.SystemVersions.listByLocation", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.oracle_subscriptions.list_by_subscription": "Azure.ResourceManager.OracleSubscriptions.listBySubscription", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.oracle_subscriptions.begin_create_or_update": "Azure.ResourceManager.OracleSubscriptions.createOrUpdate", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.oracle_subscriptions.get": "Azure.ResourceManager.OracleSubscriptions.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.oracle_subscriptions.begin_update": "Oracle.Database.OracleSubscriptions.update", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.oracle_subscriptions.begin_delete": "Azure.ResourceManager.OracleSubscriptions.delete", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.oracle_subscriptions.begin_list_cloud_account_details": "Oracle.Database.OracleSubscriptions.listCloudAccountDetails", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.oracle_subscriptions.begin_list_saas_subscription_details": "Oracle.Database.OracleSubscriptions.listSaasSubscriptionDetails", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.oracle_subscriptions.begin_list_activation_links": "Oracle.Database.OracleSubscriptions.listActivationLinks", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.oracle_subscriptions.begin_add_azure_subscriptions": "Oracle.Database.OracleSubscriptions.addAzureSubscriptions", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.db_nodes.get": "Oracle.Database.DbNodes.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.db_nodes.list_by_parent": "Oracle.Database.DbNodes.listByParent", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.db_nodes.begin_action": "Oracle.Database.DbNodes.action", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.gi_versions.get": "Oracle.Database.GiVersions.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.gi_versions.list_by_location": "Oracle.Database.GiVersions.listByLocation", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.gi_minor_versions.list_by_parent": "Oracle.Database.GiMinorVersions.listByParent", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.gi_minor_versions.get": "Oracle.Database.GiMinorVersions.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.db_system_shapes.get": "Oracle.Database.DbSystemShapes.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.db_system_shapes.list_by_location": "Oracle.Database.DbSystemShapes.listByLocation", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.dns_private_views.get": "Oracle.Database.DnsPrivateViews.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.dns_private_views.list_by_location": "Oracle.Database.DnsPrivateViews.listByLocation", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.dns_private_zones.get": "Oracle.Database.DnsPrivateZones.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.dns_private_zones.list_by_location": "Oracle.Database.DnsPrivateZones.listByLocation", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.flex_components.get": "Oracle.Database.FlexComponents.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.flex_components.list_by_parent": "Oracle.Database.FlexComponents.listByParent", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.list_by_subscription": "Azure.ResourceManager.AutonomousDatabases.listBySubscription", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.begin_create_or_update": "Azure.ResourceManager.AutonomousDatabases.createOrUpdate", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.get": "Azure.ResourceManager.AutonomousDatabases.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.begin_update": "Azure.ResourceManager.AutonomousDatabases.update", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.begin_delete": "Azure.ResourceManager.AutonomousDatabases.delete", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.list_by_resource_group": "Oracle.Database.AutonomousDatabases.listByResourceGroup", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.begin_switchover": "Oracle.Database.AutonomousDatabases.switchover", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.begin_failover": "Oracle.Database.AutonomousDatabases.failover", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.generate_wallet": "Oracle.Database.AutonomousDatabases.generateWallet", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.begin_restore": "Oracle.Database.AutonomousDatabases.restore", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.begin_shrink": "Oracle.Database.AutonomousDatabases.shrink", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_databases.begin_change_disaster_recovery_configuration": "Oracle.Database.AutonomousDatabases.changeDisasterRecoveryConfiguration", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_backups.begin_create_or_update": "Azure.ResourceManager.AutonomousDatabaseBackups.createOrUpdate", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_backups.get": "Azure.ResourceManager.AutonomousDatabaseBackups.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_backups.begin_delete": "Azure.ResourceManager.AutonomousDatabaseBackups.delete", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_backups.begin_update": "Oracle.Database.AutonomousDatabaseBackups.update", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_backups.list_by_parent": "Oracle.Database.AutonomousDatabaseBackups.listByParent", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_character_sets.get": "Oracle.Database.AutonomousDatabaseCharacterSets.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_character_sets.list_by_location": "Oracle.Database.AutonomousDatabaseCharacterSets.listByLocation", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_national_character_sets.get": "Oracle.Database.AutonomousDatabaseNationalCharacterSets.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_national_character_sets.list_by_location": "Oracle.Database.AutonomousDatabaseNationalCharacterSets.listByLocation", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_versions.get": "Oracle.Database.AutonomousDatabaseVersions.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.autonomous_database_versions.list_by_location": "Oracle.Database.AutonomousDatabaseVersions.listByLocation", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exadb_vm_clusters.list_by_subscription": "Azure.ResourceManager.ExadbVmClusters.listBySubscription", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exadb_vm_clusters.begin_create_or_update": "Azure.ResourceManager.ExadbVmClusters.createOrUpdate", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exadb_vm_clusters.get": "Azure.ResourceManager.ExadbVmClusters.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exadb_vm_clusters.begin_update": "Azure.ResourceManager.ExadbVmClusters.update", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exadb_vm_clusters.begin_delete": "Azure.ResourceManager.ExadbVmClusters.delete", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exadb_vm_clusters.list_by_resource_group": "Oracle.Database.ExadbVmClusters.listByResourceGroup", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exadb_vm_clusters.begin_remove_vms": "Oracle.Database.ExadbVmClusters.removeVms", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exascale_db_nodes.get": "Oracle.Database.ExascaleDbNodes.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exascale_db_nodes.list_by_parent": "Oracle.Database.ExascaleDbNodes.listByParent", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exascale_db_nodes.begin_action": "Oracle.Database.ExascaleDbNodes.action", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exascale_db_storage_vaults.get": "Oracle.Database.ExascaleDbStorageVaults.get", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exascale_db_storage_vaults.begin_create": "Oracle.Database.ExascaleDbStorageVaults.create", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exascale_db_storage_vaults.begin_update": "Oracle.Database.ExascaleDbStorageVaults.update", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exascale_db_storage_vaults.begin_delete": "Oracle.Database.ExascaleDbStorageVaults.delete", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exascale_db_storage_vaults.list_by_resource_group": "Oracle.Database.ExascaleDbStorageVaults.listByResourceGroup", + "azure.mgmt.oracledatabase.OracleDatabaseMgmtClient.exascale_db_storage_vaults.list_by_subscription": "Oracle.Database.ExascaleDbStorageVaults.listBySubscription" + } +} \ No newline at end of file diff --git a/sdk/oracledatabase/arm-oracledatabase/dev_requirements.txt b/sdk/oracledatabase/arm-oracledatabase/dev_requirements.txt new file mode 100644 index 000000000000..05b9717a94f4 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/dev_requirements.txt @@ -0,0 +1,5 @@ +-e ../../../tools/azure-sdk-tools +../../core/azure-core +../../identity/azure-identity +../../core/azure-mgmt-core +aiohttp \ No newline at end of file diff --git a/sdk/oracledatabase/arm-oracledatabase/models/__init__.py b/sdk/oracledatabase/arm-oracledatabase/models/__init__.py new file mode 100644 index 000000000000..2e097754c69e --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/models/__init__.py @@ -0,0 +1,358 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + AddRemoveDbNode, + AllConnectionStringType, + ApexDetailsType, + AutonomousDatabase, + AutonomousDatabaseBackup, + AutonomousDatabaseBackupProperties, + AutonomousDatabaseBaseProperties, + AutonomousDatabaseCharacterSet, + AutonomousDatabaseCharacterSetProperties, + AutonomousDatabaseCloneProperties, + AutonomousDatabaseCrossRegionDisasterRecoveryProperties, + AutonomousDatabaseFromBackupTimestampProperties, + AutonomousDatabaseNationalCharacterSet, + AutonomousDatabaseNationalCharacterSetProperties, + AutonomousDatabaseProperties, + AutonomousDatabaseStandbySummary, + AutonomousDatabaseUpdate, + AutonomousDatabaseUpdateProperties, + AutonomousDatabaseWalletFile, + AutonomousDbVersion, + AutonomousDbVersionProperties, + AzureSubscriptions, + CloudExadataInfrastructure, + CloudExadataInfrastructureProperties, + CloudExadataInfrastructureUpdate, + CloudExadataInfrastructureUpdateProperties, + CloudVmCluster, + CloudVmClusterProperties, + CloudVmClusterUpdate, + CloudVmClusterUpdateProperties, + ConnectionStringType, + ConnectionUrlType, + CustomerContact, + DataCollectionOptions, + DayOfWeek, + DbActionResponse, + DbIormConfig, + DbNode, + DbNodeAction, + DbNodeDetails, + DbNodeProperties, + DbServer, + DbServerPatchingDetails, + DbServerProperties, + DbSystemShape, + DbSystemShapeProperties, + DefinedFileSystemConfiguration, + DisasterRecoveryConfigurationDetails, + DnsPrivateView, + DnsPrivateViewProperties, + DnsPrivateZone, + DnsPrivateZoneProperties, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + EstimatedPatchingTime, + ExadataIormConfig, + ExadbVmCluster, + ExadbVmClusterProperties, + ExadbVmClusterStorageDetails, + ExadbVmClusterUpdate, + ExadbVmClusterUpdateProperties, + ExascaleDbNode, + ExascaleDbNodeProperties, + ExascaleDbStorageDetails, + ExascaleDbStorageInputDetails, + ExascaleDbStorageVault, + ExascaleDbStorageVaultProperties, + ExascaleDbStorageVaultTagsUpdate, + FileSystemConfigurationDetails, + FlexComponent, + FlexComponentProperties, + GenerateAutonomousDatabaseWalletDetails, + GiMinorVersion, + GiMinorVersionProperties, + GiVersion, + GiVersionProperties, + LongTermBackUpScheduleDetails, + MaintenanceWindow, + Month, + NsgCidr, + Operation, + OperationDisplay, + OracleSubscription, + OracleSubscriptionProperties, + OracleSubscriptionUpdate, + OracleSubscriptionUpdateProperties, + PeerDbDetails, + Plan, + PlanUpdate, + PortRange, + PrivateIpAddressProperties, + PrivateIpAddressesFilter, + ProfileType, + ProxyResource, + RemoveVirtualMachineFromExadbVmClusterDetails, + Resource, + RestoreAutonomousDatabaseDetails, + ScheduledOperationsType, + SystemData, + SystemVersion, + SystemVersionProperties, + TrackedResource, + VirtualNetworkAddress, + VirtualNetworkAddressProperties, +) + +from ._enums import ( # type: ignore + ActionType, + AddSubscriptionOperationState, + 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, + ExadbVmClusterLifecycleState, + ExascaleDbStorageVaultLifecycleState, + GenerateType, + GridImageType, + HardwareType, + HostFormatType, + Intent, + IormLifecycleState, + LicenseModel, + MonthName, + Objective, + OpenModeType, + OperationsInsightsStatusType, + OracleSubscriptionProvisioningState, + Origin, + PatchingMode, + PermissionLevelType, + Preference, + ProtocolType, + RefreshableModelType, + RefreshableStatusType, + RepeatCadenceType, + ResourceProvisioningState, + RoleType, + SessionModeType, + ShapeFamily, + SourceType, + SyntaxFormatType, + SystemShapes, + TlsAuthenticationType, + VirtualNetworkAddressLifecycleState, + WorkloadType, + ZoneType, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AddRemoveDbNode", + "AllConnectionStringType", + "ApexDetailsType", + "AutonomousDatabase", + "AutonomousDatabaseBackup", + "AutonomousDatabaseBackupProperties", + "AutonomousDatabaseBaseProperties", + "AutonomousDatabaseCharacterSet", + "AutonomousDatabaseCharacterSetProperties", + "AutonomousDatabaseCloneProperties", + "AutonomousDatabaseCrossRegionDisasterRecoveryProperties", + "AutonomousDatabaseFromBackupTimestampProperties", + "AutonomousDatabaseNationalCharacterSet", + "AutonomousDatabaseNationalCharacterSetProperties", + "AutonomousDatabaseProperties", + "AutonomousDatabaseStandbySummary", + "AutonomousDatabaseUpdate", + "AutonomousDatabaseUpdateProperties", + "AutonomousDatabaseWalletFile", + "AutonomousDbVersion", + "AutonomousDbVersionProperties", + "AzureSubscriptions", + "CloudExadataInfrastructure", + "CloudExadataInfrastructureProperties", + "CloudExadataInfrastructureUpdate", + "CloudExadataInfrastructureUpdateProperties", + "CloudVmCluster", + "CloudVmClusterProperties", + "CloudVmClusterUpdate", + "CloudVmClusterUpdateProperties", + "ConnectionStringType", + "ConnectionUrlType", + "CustomerContact", + "DataCollectionOptions", + "DayOfWeek", + "DbActionResponse", + "DbIormConfig", + "DbNode", + "DbNodeAction", + "DbNodeDetails", + "DbNodeProperties", + "DbServer", + "DbServerPatchingDetails", + "DbServerProperties", + "DbSystemShape", + "DbSystemShapeProperties", + "DefinedFileSystemConfiguration", + "DisasterRecoveryConfigurationDetails", + "DnsPrivateView", + "DnsPrivateViewProperties", + "DnsPrivateZone", + "DnsPrivateZoneProperties", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "EstimatedPatchingTime", + "ExadataIormConfig", + "ExadbVmCluster", + "ExadbVmClusterProperties", + "ExadbVmClusterStorageDetails", + "ExadbVmClusterUpdate", + "ExadbVmClusterUpdateProperties", + "ExascaleDbNode", + "ExascaleDbNodeProperties", + "ExascaleDbStorageDetails", + "ExascaleDbStorageInputDetails", + "ExascaleDbStorageVault", + "ExascaleDbStorageVaultProperties", + "ExascaleDbStorageVaultTagsUpdate", + "FileSystemConfigurationDetails", + "FlexComponent", + "FlexComponentProperties", + "GenerateAutonomousDatabaseWalletDetails", + "GiMinorVersion", + "GiMinorVersionProperties", + "GiVersion", + "GiVersionProperties", + "LongTermBackUpScheduleDetails", + "MaintenanceWindow", + "Month", + "NsgCidr", + "Operation", + "OperationDisplay", + "OracleSubscription", + "OracleSubscriptionProperties", + "OracleSubscriptionUpdate", + "OracleSubscriptionUpdateProperties", + "PeerDbDetails", + "Plan", + "PlanUpdate", + "PortRange", + "PrivateIpAddressProperties", + "PrivateIpAddressesFilter", + "ProfileType", + "ProxyResource", + "RemoveVirtualMachineFromExadbVmClusterDetails", + "Resource", + "RestoreAutonomousDatabaseDetails", + "ScheduledOperationsType", + "SystemData", + "SystemVersion", + "SystemVersionProperties", + "TrackedResource", + "VirtualNetworkAddress", + "VirtualNetworkAddressProperties", + "ActionType", + "AddSubscriptionOperationState", + "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", + "ExadbVmClusterLifecycleState", + "ExascaleDbStorageVaultLifecycleState", + "GenerateType", + "GridImageType", + "HardwareType", + "HostFormatType", + "Intent", + "IormLifecycleState", + "LicenseModel", + "MonthName", + "Objective", + "OpenModeType", + "OperationsInsightsStatusType", + "OracleSubscriptionProvisioningState", + "Origin", + "PatchingMode", + "PermissionLevelType", + "Preference", + "ProtocolType", + "RefreshableModelType", + "RefreshableStatusType", + "RepeatCadenceType", + "ResourceProvisioningState", + "RoleType", + "SessionModeType", + "ShapeFamily", + "SourceType", + "SyntaxFormatType", + "SystemShapes", + "TlsAuthenticationType", + "VirtualNetworkAddressLifecycleState", + "WorkloadType", + "ZoneType", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/oracledatabase/arm-oracledatabase/models/_enums.py b/sdk/oracledatabase/arm-oracledatabase/models/_enums.py new file mode 100644 index 000000000000..c49c5842a583 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/models/_enums.py @@ -0,0 +1,793 @@ +# 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) Python 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): + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ + + INTERNAL = "Internal" + """Actions are for internal-only APIs.""" + + +class AddSubscriptionOperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Add Subscription Operation state enum.""" + + SUCCEEDED = "Succeeded" + """Succeeded - State when Add Subscription operation succeeded""" + UPDATING = "Updating" + """Updating - State when Add Subscription operation is being Updated""" + FAILED = "Failed" + """Failed - State when Add Subscription operation failed""" + + +class AutonomousDatabaseBackupLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Autonomous database backup lifecycle state enum.""" + + CREATING = "Creating" + """AutonomousDatabase backup is creating""" + ACTIVE = "Active" + """AutonomousDatabase backup is active""" + DELETING = "Deleting" + """AutonomousDatabase backup is deleting""" + FAILED = "Failed" + """AutonomousDatabase backup is failed""" + UPDATING = "Updating" + """AutonomousDatabase backup is updating""" + + +class AutonomousDatabaseBackupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Autonomous database backup type enum.""" + + INCREMENTAL = "Incremental" + """Incremental backup""" + FULL = "Full" + """Full backup""" + LONG_TERM = "LongTerm" + """LongTerm backup""" + + +class AutonomousDatabaseLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Autonomous database lifecycle state enum.""" + + PROVISIONING = "Provisioning" + """Indicates that resource in Provisioning state""" + AVAILABLE = "Available" + """Indicates that resource in Available state""" + STOPPING = "Stopping" + """Indicates that resource in Stopping state""" + STOPPED = "Stopped" + """Indicates that resource in Stopped state""" + STARTING = "Starting" + """Indicates that resource in Starting state""" + TERMINATING = "Terminating" + """Indicates that resource in Terminating state""" + TERMINATED = "Terminated" + """Indicates that resource in Terminated state""" + UNAVAILABLE = "Unavailable" + """Indicates that resource in Unavailable state""" + RESTORE_IN_PROGRESS = "RestoreInProgress" + """Indicates that resource in RestoreInProgress state""" + RESTORE_FAILED = "RestoreFailed" + """Indicates that resource in RestoreFailed state""" + BACKUP_IN_PROGRESS = "BackupInProgress" + """Indicates that resource in BackupInProgress state""" + SCALE_IN_PROGRESS = "ScaleInProgress" + """Indicates that resource in ScaleInProgress state""" + AVAILABLE_NEEDS_ATTENTION = "AvailableNeedsAttention" + """Indicates that resource is available but needs attention""" + UPDATING = "Updating" + """Indicates that resource in Updating state""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """Indicates that resource maintenance in progress state""" + RESTARTING = "Restarting" + """Indicates that resource in Restarting state""" + RECREATING = "Recreating" + """Indicates that resource in Recreating state""" + ROLE_CHANGE_IN_PROGRESS = "RoleChangeInProgress" + """Indicates that resource role change in progress state""" + UPGRADING = "Upgrading" + """Indicates that resource in Upgrading state""" + INACCESSIBLE = "Inaccessible" + """IIndicates that resource in Inaccessible state""" + STANDBY = "Standby" + """Indicates that resource in Standby state""" + + +class AutonomousMaintenanceScheduleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Autonomous database maintenance schedule type enum.""" + + EARLY = "Early" + """Early maintenance schedule""" + REGULAR = "Regular" + """Regular maintenance schedule""" + + +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" + """Indicates that resource in Provisioning state""" + + +class CloneType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Clone type enum.""" + + FULL = "Full" + """Full clone""" + METADATA = "Metadata" + """Metadata only""" + + +class CloudAccountProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CloudAccountProvisioningState enum.""" + + PENDING = "Pending" + """Pending - Initial state when Oracle cloud account is not configured""" + PROVISIONING = "Provisioning" + """Provisioning - State when Oracle cloud account is being provisioned""" + AVAILABLE = "Available" + """Available - State when Oracle cloud account cloud linking is complete and it is available""" + + +class CloudExadataInfrastructureLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CloudExadataInfrastructureLifecycleState enum.""" + + PROVISIONING = "Provisioning" + """Indicates that resource in Provisioning state""" + AVAILABLE = "Available" + """Indicates that resource in Available state""" + UPDATING = "Updating" + """Indicates that resource in Updating state""" + TERMINATING = "Terminating" + """Indicates that resource in Terminating state""" + TERMINATED = "Terminated" + """Indicates that resource in Terminated state""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """Indicates that resource maintenance in progress state""" + FAILED = "Failed" + """Indicates that resource in Failed state""" + + +class CloudVmClusterLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Cloud VM Cluster lifecycle state enum.""" + + PROVISIONING = "Provisioning" + """Indicates that resource in Provisioning state""" + AVAILABLE = "Available" + """Indicates that resource in Available state""" + UPDATING = "Updating" + """Indicates that resource in Updating state""" + TERMINATING = "Terminating" + """Indicates that resource in Terminating state""" + TERMINATED = "Terminated" + """Indicates that resource in Terminated state""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """Indicates that resource Maintenance in progress state""" + FAILED = "Failed" + """Indicates that resource in Failed state""" + + +class ComputeModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Compute model enum.""" + + ECPU = "ECPU" + """ECPU model type""" + OCPU = "OCPU" + """OCPU model type""" + + +class ConsumerGroup(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Consumer group enum.""" + + HIGH = "High" + """High group""" + MEDIUM = "Medium" + """Medium group""" + LOW = "Low" + """Low group""" + TP = "Tp" + """TP group""" + TPURGENT = "Tpurgent" + """TPurgent group""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of entity that created the resource.""" + + USER = "User" + """The entity was created by a user.""" + APPLICATION = "Application" + """The entity was created by an application.""" + MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" + KEY = "Key" + """The entity was created by a key.""" + + +class DatabaseEditionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Database edition type enum.""" + + STANDARD_EDITION = "StandardEdition" + """Standard edition""" + ENTERPRISE_EDITION = "EnterpriseEdition" + """Enterprise edition""" + + +class DataBaseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Database type enum.""" + + REGULAR = "Regular" + """Regular DB""" + CLONE = "Clone" + """Clone DB""" + CLONE_FROM_BACKUP_TIMESTAMP = "CloneFromBackupTimestamp" + """Clone DB from backup timestamp""" + CROSS_REGION_DISASTER_RECOVERY = "CrossRegionDisasterRecovery" + """Cross Region Disaster Recovery""" + + +class DataSafeStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataSafe status type enum.""" + + REGISTERING = "Registering" + """Registering status""" + REGISTERED = "Registered" + """Registered status""" + DEREGISTERING = "Deregistering" + """Deregistering status""" + NOT_REGISTERED = "NotRegistered" + """NotRegistered status""" + FAILED = "Failed" + """Failed status""" + + +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" + """VMDB reboot migration maintenance type""" + + +class DbNodeProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DnNode provisioning state enum.""" + + PROVISIONING = "Provisioning" + """Indicates that resource in Provisioning state""" + AVAILABLE = "Available" + """Indicates that resource in Available state""" + UPDATING = "Updating" + """Indicates that resource in Updating state""" + STOPPING = "Stopping" + """Indicates that resource in Stopping state""" + STOPPED = "Stopped" + """Indicates that resource in Stopped state""" + STARTING = "Starting" + """Indicates that resource in Starting state""" + TERMINATING = "Terminating" + """Indicates that resource in Terminating state""" + TERMINATED = "Terminated" + """Indicates that resource in Terminated state""" + FAILED = "Failed" + """Indicates that resource in Failed state""" + + +class DbServerPatchingStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DB Server patching status enum.""" + + SCHEDULED = "Scheduled" + """Patching scheduled""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """Patching in progress""" + FAILED = "Failed" + """Patching failed""" + COMPLETE = "Complete" + """Patching completed""" + + +class DbServerProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DbServerProvisioningState enum.""" + + CREATING = "Creating" + """Indicates that resource in Creating state""" + AVAILABLE = "Available" + """Indicates that resource in Available state""" + UNAVAILABLE = "Unavailable" + """Indicates that resource in Unavailable state""" + DELETING = "Deleting" + """Indicates that resource in Deleting state""" + DELETED = "Deleted" + """Indicates that resource in Deleted state""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """Indicates that resource maintenance in progress state""" + + +class DisasterRecoveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Disaster recovery type enum.""" + + ADG = "Adg" + """ADG type""" + BACKUP_BASED = "BackupBased" + """Backup based type""" + + +class DiskRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Disk redundancy enum.""" + + HIGH = "High" + """High redundancy""" + NORMAL = "Normal" + """Normal redundancy""" + + +class DnsPrivateViewsLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DNS Private Views lifecycle state enum.""" + + ACTIVE = "Active" + """DNS Private View is active""" + DELETED = "Deleted" + """DNS Private View is deleted""" + DELETING = "Deleting" + """DNS Private View is deleting""" + UPDATING = "Updating" + """DNS Private View is updating""" + + +class DnsPrivateZonesLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DNS Private Zones lifecycle state enum.""" + + ACTIVE = "Active" + """DNS Private Zones is active""" + CREATING = "Creating" + """DNS Private Zones is creating""" + DELETED = "Deleted" + """DNS Private Zones is deleted""" + DELETING = "Deleting" + """DNS Private Zones is deleting""" + UPDATING = "Updating" + """DNS Private Zones is updating""" + + +class ExadbVmClusterLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Exadata VM cluster on Exascale Infrastructure lifecycle state enum.""" + + PROVISIONING = "Provisioning" + """Indicates that resource in Provisioning state""" + AVAILABLE = "Available" + """Indicates that resource in Available state""" + UPDATING = "Updating" + """Indicates that resource in Updating state""" + TERMINATING = "Terminating" + """Indicates that resource in Terminating state""" + TERMINATED = "Terminated" + """Indicates that resource in Terminated state""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """Indicates that resource Maintenance in progress state""" + FAILED = "Failed" + """Indicates that resource in Failed state""" + + +class ExascaleDbStorageVaultLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Exadata Database Storage Vault lifecycle state enum.""" + + PROVISIONING = "Provisioning" + """Indicates that resource in Provisioning state""" + AVAILABLE = "Available" + """Indicates that resource in Available state""" + UPDATING = "Updating" + """Indicates that resource in Updating state""" + TERMINATING = "Terminating" + """Indicates that resource in Terminating state""" + TERMINATED = "Terminated" + """Indicates that resource in Terminated state""" + FAILED = "Failed" + """Indicates that resource in Failed state""" + + +class GenerateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Generate type enum.""" + + SINGLE = "Single" + """Generate single""" + ALL = "All" + """Generate all""" + + +class GridImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GridImageType enum.""" + + RELEASE_UPDATE = "ReleaseUpdate" + """Release update""" + CUSTOM_IMAGE = "CustomImage" + """Custom image""" + + +class HardwareType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Hardware Type enum.""" + + COMPUTE = "COMPUTE" + """Hardware type is Database Server""" + CELL = "CELL" + """Hardware type is Storage Server""" + + +class HostFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Host format type enum.""" + + FQDN = "Fqdn" + """FQDN format""" + IP = "Ip" + """IP format""" + + +class Intent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Intent enum.""" + + RETAIN = "Retain" + """Retain intent""" + RESET = "Reset" + """Reset intent""" + + +class IormLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ORM lifecycle state enum.""" + + BOOT_STRAPPING = "BootStrapping" + """Indicates that resource in Provisioning state""" + ENABLED = "Enabled" + """Indicates that resource in Enabled state""" + DISABLED = "Disabled" + """Indicates that resource in Disabled state""" + UPDATING = "Updating" + """Indicates that resource in Updating state""" + FAILED = "Failed" + """Indicates that resource in Failed state""" + + +class LicenseModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LicenseModel enum.""" + + LICENSE_INCLUDED = "LicenseIncluded" + """License included""" + BRING_YOUR_OWN_LICENSE = "BringYourOwnLicense" + """Bring Your Own License""" + + +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 objective""" + HIGH_THROUGHPUT = "HighThroughput" + """High throughput objective""" + BALANCED = "Balanced" + """Balanced objective""" + AUTO = "Auto" + """Auto objective""" + BASIC = "Basic" + """Basic objective""" + + +class OpenModeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Open mode type enum.""" + + READ_ONLY = "ReadOnly" + """ReadOnly mode""" + READ_WRITE = "ReadWrite" + """ReadWrite mode""" + + +class OperationsInsightsStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operations Insights status type enum.""" + + ENABLING = "Enabling" + """Enabling status""" + ENABLED = "Enabled" + """Enabled status""" + DISABLING = "Disabling" + """Disabling status""" + NOT_ENABLED = "NotEnabled" + """NotEnabled status""" + FAILED_ENABLING = "FailedEnabling" + """FailedEnabling status""" + FAILED_DISABLING = "FailedDisabling" + """FailedDisabling status""" + + +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" + """Indicates the operation is initiated by a user.""" + SYSTEM = "system" + """Indicates the operation is initiated by a system.""" + USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" + + +class PatchingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Patching mode enum.""" + + ROLLING = "Rolling" + """Rolling patching""" + NON_ROLLING = "NonRolling" + """Non Rolling patching""" + + +class PermissionLevelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Permission level type enum.""" + + RESTRICTED = "Restricted" + """Restricted permission level""" + UNRESTRICTED = "Unrestricted" + """Unrestricted permission level""" + + +class Preference(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Preference enum.""" + + NO_PREFERENCE = "NoPreference" + """No preference""" + CUSTOM_PREFERENCE = "CustomPreference" + """Custom preference""" + + +class ProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol type enum.""" + + TCP = "TCP" + """TCP protocol""" + TCPS = "TCPS" + """TCPS protocol""" + + +class RefreshableModelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Refreshable model type enum.""" + + AUTOMATIC = "Automatic" + """Automatic refreshable model type""" + MANUAL = "Manual" + """Manual refreshable model type""" + + +class RefreshableStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Refreshable status type enum.""" + + REFRESHING = "Refreshing" + """Refreshing status""" + NOT_REFRESHING = "NotRefreshing" + """NotRefreshing status""" + + +class RepeatCadenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Repeat cadence type enum.""" + + ONE_TIME = "OneTime" + """Repeat one time""" + WEEKLY = "Weekly" + """Repeat weekly""" + MONTHLY = "Monthly" + """Repeat monthly""" + YEARLY = "Yearly" + """Repeat yearly""" + + +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): + """Role type enum.""" + + PRIMARY = "Primary" + """Primary role""" + STANDBY = "Standby" + """Standby role""" + DISABLED_STANDBY = "DisabledStandby" + """DisabledStandby role""" + BACKUP_COPY = "BackupCopy" + """BackupCopy role""" + SNAPSHOT_STANDBY = "SnapshotStandby" + """SnapshotStandby role""" + + +class SessionModeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Session mode type enum.""" + + DIRECT = "Direct" + """Direct session mode""" + REDIRECT = "Redirect" + """Redirect session mode""" + + +class ShapeFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Allowed values for GI Minor Versions shapeFamily filter.""" + + EXADATA = "EXADATA" + """Family value for Exadata Shape""" + EXADB_XS = "EXADB_XS" + """Family value for Exadb XS Shape""" + + +class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Source type enum.""" + + NONE = "None" + """None source""" + DATABASE = "Database" + """Database source""" + BACKUP_FROM_ID = "BackupFromId" + """Backup from ID source""" + BACKUP_FROM_TIMESTAMP = "BackupFromTimestamp" + """Backup from timestamp source""" + CLONE_TO_REFRESHABLE = "CloneToRefreshable" + """Clone to refreshable source""" + CROSS_REGION_DATAGUARD = "CrossRegionDataguard" + """Cross region dataguard source""" + CROSS_REGION_DISASTER_RECOVERY = "CrossRegionDisasterRecovery" + """cross region disaster recovery source""" + + +class SyntaxFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Syntax format type enum.""" + + LONG = "Long" + """Long format""" + EZCONNECT = "Ezconnect" + """Ezconnect format""" + EZCONNECTPLUS = "Ezconnectplus" + """Ezconnectplus format""" + + +class SystemShapes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Allowed values for System Shapes.""" + + EXADATA_X9_M = "Exadata.X9M" + """Exadata X9M shape""" + EXADATA_X11_M = "Exadata.X11M" + """Exadata X11M shape""" + EXA_DB_XS = "ExaDbXS" + """Exadata DB on Exascale Infrastructure shape""" + + +class TlsAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """TLS authentication type enum.""" + + SERVER = "Server" + """Server authentication""" + MUTUAL = "Mutual" + """Mutual TLS""" + + +class VirtualNetworkAddressLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VirtualNetworkAddressLifecycleState enum.""" + + PROVISIONING = "Provisioning" + """Indicates that resource in Provisioning state""" + AVAILABLE = "Available" + """Indicates that resource in Available state""" + TERMINATING = "Terminating" + """Indicates that resource in Terminating state""" + TERMINATED = "Terminated" + """Indicates that resource in Terminated state""" + FAILED = "Failed" + """Indicates that resource in Failed state""" + + +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): + """Zone type enum.""" + + PRIMARY = "Primary" + """Primary zone""" + SECONDARY = "Secondary" + """Secondary zone""" diff --git a/sdk/oracledatabase/arm-oracledatabase/models/_models.py b/sdk/oracledatabase/arm-oracledatabase/models/_models.py new file mode 100644 index 000000000000..65926a4b3ffb --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/models/_models.py @@ -0,0 +1,7685 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Dict, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .. import _model_base +from .._model_base import rest_discriminator, rest_field +from ._enums import DataBaseType, SourceType + +if TYPE_CHECKING: + from .. import models as _models + + +class AddRemoveDbNode(_model_base.Model): + """Add/Remove (Virtual Machine) DbNode model. + + :ivar db_servers: Db servers ocids. Required. + :vartype db_servers: list[str] + """ + + db_servers: List[str] = rest_field(name="dbServers", visibility=["read", "create", "update", "delete", "query"]) + """Db servers ocids. Required.""" + + @overload + def __init__( + self, + *, + db_servers: List[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AllConnectionStringType(_model_base.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 + """ + + high: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + low: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Low database service provides the least level of resources to each SQL statement, but + supports the most number of concurrent SQL statements.""" + medium: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + + @overload + def __init__( + self, + *, + high: Optional[str] = None, + low: Optional[str] = None, + medium: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApexDetailsType(_model_base.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 + """ + + apex_version: Optional[str] = rest_field( + name="apexVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The Oracle APEX Application Development version.""" + ords_version: Optional[str] = rest_field( + name="ordsVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The Oracle REST Data Services (ORDS) version.""" + + @overload + def __init__( + self, + *, + apex_version: Optional[str] = None, + ords_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_model_base.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabase(TrackedResource): + """Autonomous Database resource model. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.AutonomousDatabaseBaseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AutonomousDatabaseBaseProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.AutonomousDatabaseBackupProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AutonomousDatabaseBackupProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseBackupProperties(_model_base.Model): + """AutonomousDatabaseBackup resource model. + + :ivar autonomous_database_ocid: The OCID of the Autonomous Database. + :vartype autonomous_database_ocid: str + :ivar database_size_in_tbs: The size of the database in terabytes at the time the backup was + taken. + :vartype database_size_in_tbs: float + :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. + :vartype retention_period_in_days: int + :ivar size_in_tbs: The backup size in terabytes (TB). + :vartype size_in_tbs: float + :ivar time_available_til: Timestamp until when the backup will be available. + :vartype time_available_til: ~datetime.datetime + :ivar time_started: The date and time the backup started. + :vartype time_started: str + :ivar time_ended: The date and time the backup completed. + :vartype time_ended: str + :ivar backup_type: The type of backup. Known values are: "Incremental", "Full", and "LongTerm". + :vartype backup_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 + """ + + autonomous_database_ocid: Optional[str] = rest_field(name="autonomousDatabaseOcid", visibility=["read"]) + """The OCID of the Autonomous Database.""" + database_size_in_tbs: Optional[float] = rest_field(name="databaseSizeInTbs", visibility=["read"]) + """The size of the database in terabytes at the time the backup was taken.""" + db_version: Optional[str] = rest_field(name="dbVersion", visibility=["read"]) + """A valid Oracle Database version for Autonomous Database.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read", "create"]) + """The user-friendly name for the backup. The name does not have to be unique.""" + ocid: Optional[str] = rest_field(visibility=["read"]) + """The OCID of the Autonomous Database backup.""" + is_automatic: Optional[bool] = rest_field(name="isAutomatic", visibility=["read"]) + """Indicates whether the backup is user-initiated or automatic.""" + is_restorable: Optional[bool] = rest_field(name="isRestorable", visibility=["read"]) + """Indicates whether the backup can be used to restore the associated Autonomous Database.""" + lifecycle_details: Optional[str] = rest_field(name="lifecycleDetails", visibility=["read"]) + """Additional information about the current lifecycle state.""" + lifecycle_state: Optional[Union[str, "_models.AutonomousDatabaseBackupLifecycleState"]] = rest_field( + name="lifecycleState", visibility=["read"] + ) + """The current state of the backup. Known values are: \"Creating\", \"Active\", \"Deleting\", + \"Failed\", and \"Updating\".""" + retention_period_in_days: Optional[int] = rest_field( + name="retentionPeriodInDays", visibility=["read", "create", "update"] + ) + """Retention period, in days.""" + size_in_tbs: Optional[float] = rest_field(name="sizeInTbs", visibility=["read"]) + """The backup size in terabytes (TB).""" + time_available_til: Optional[datetime.datetime] = rest_field( + name="timeAvailableTil", visibility=["read"], format="rfc3339" + ) + """Timestamp until when the backup will be available.""" + time_started: Optional[str] = rest_field(name="timeStarted", visibility=["read"]) + """The date and time the backup started.""" + time_ended: Optional[str] = rest_field(name="timeEnded", visibility=["read"]) + """The date and time the backup completed.""" + backup_type: Optional[Union[str, "_models.AutonomousDatabaseBackupType"]] = rest_field( + name="backupType", visibility=["read"] + ) + """The type of backup. Known values are: \"Incremental\", \"Full\", and \"LongTerm\".""" + provisioning_state: Optional[Union[str, "_models.AzureResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Azure resource provisioning state. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", + and \"Provisioning\".""" + + @overload + def __init__( + self, + *, + display_name: Optional[str] = None, + retention_period_in_days: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseBaseProperties(_model_base.Model): + """Autonomous Database base resource model. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AutonomousDatabaseCloneProperties, AutonomousDatabaseFromBackupTimestampProperties, + AutonomousDatabaseCrossRegionDisasterRecoveryProperties, AutonomousDatabaseProperties + + :ivar admin_password: Admin password. + :vartype admin_password: str + :ivar data_base_type: Database type to be created. Required. Known values are: "Regular", + "Clone", "CloneFromBackupTimestamp", and "CrossRegionDisasterRecovery". + :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 Azure resource IDs of standby databases located in Autonomous + Data Guard remote regions that are associated with the source database. Note that for + Autonomous Database Serverless instances, standby databases located in the same region as the + source primary database do not have Azure IDs. + :vartype peer_db_ids: list[str] + :ivar peer_db_id: The Azure resource ID 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 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: ~datetime.datetime + :ivar remote_disaster_recovery_configuration: Indicates remote disaster recovery configuration. + :vartype remote_disaster_recovery_configuration: + ~azure.mgmt.oracledatabase.models.DisasterRecoveryConfigurationDetails + :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 next_long_term_backup_time_stamp: The date and time when the next long-term backup would + be created. + :vartype next_long_term_backup_time_stamp: ~datetime.datetime + :ivar long_term_backup_schedule: Details for the long-term backup schedule. + :vartype long_term_backup_schedule: + ~azure.mgmt.oracledatabase.models.LongTermBackUpScheduleDetails + :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] + """ + + __mapping__: Dict[str, _model_base.Model] = {} + admin_password: Optional[str] = rest_field(name="adminPassword", visibility=["create", "update"]) + """Admin password.""" + data_base_type: str = rest_discriminator(name="dataBaseType", visibility=["create"]) + """Database type to be created. Required. Known values are: \"Regular\", \"Clone\", + \"CloneFromBackupTimestamp\", and \"CrossRegionDisasterRecovery\".""" + autonomous_maintenance_schedule_type: Optional[Union[str, "_models.AutonomousMaintenanceScheduleType"]] = ( + rest_field(name="autonomousMaintenanceScheduleType", visibility=["read", "create", "update"]) + ) + """The maintenance schedule type of the Autonomous Database Serverless. Known values are: + \"Early\" and \"Regular\".""" + character_set: Optional[str] = rest_field(name="characterSet", visibility=["read", "create"]) + """The character set for the autonomous database.""" + compute_count: Optional[float] = rest_field(name="computeCount", visibility=["read", "create", "update"]) + """The compute amount (CPUs) available to the database.""" + compute_model: Optional[Union[str, "_models.ComputeModel"]] = rest_field( + name="computeModel", visibility=["read", "create"] + ) + """The compute model of the Autonomous Database. Known values are: \"ECPU\" and \"OCPU\".""" + cpu_core_count: Optional[int] = rest_field(name="cpuCoreCount", visibility=["read", "create", "update"]) + """The number of CPU cores to be made available to the database.""" + customer_contacts: Optional[List["_models.CustomerContact"]] = rest_field( + name="customerContacts", visibility=["read", "create", "update"] + ) + """Customer Contacts.""" + data_storage_size_in_tbs: Optional[int] = rest_field( + name="dataStorageSizeInTbs", visibility=["read", "create", "update"] + ) + """The quantity of data in the database, in terabytes.""" + data_storage_size_in_gbs: Optional[int] = rest_field( + name="dataStorageSizeInGbs", visibility=["read", "create", "update"] + ) + """The size, in gigabytes, of the data volume that will be created and attached to the database.""" + db_version: Optional[str] = rest_field(name="dbVersion", visibility=["read", "create"]) + """A valid Oracle Database version for Autonomous Database.""" + db_workload: Optional[Union[str, "_models.WorkloadType"]] = rest_field( + name="dbWorkload", visibility=["read", "create"] + ) + """The Autonomous Database workload type. Known values are: \"OLTP\", \"DW\", \"AJD\", and + \"APEX\".""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read", "create", "update"]) + """The user-friendly name for the Autonomous Database.""" + is_auto_scaling_enabled: Optional[bool] = rest_field( + name="isAutoScalingEnabled", visibility=["read", "create", "update"] + ) + """Indicates if auto scaling is enabled for the Autonomous Database CPU core count.""" + is_auto_scaling_for_storage_enabled: Optional[bool] = rest_field( + name="isAutoScalingForStorageEnabled", visibility=["read", "create", "update"] + ) + """Indicates if auto scaling is enabled for the Autonomous Database storage.""" + peer_db_ids: Optional[List[str]] = rest_field(name="peerDbIds", visibility=["read"]) + """The list of Azure resource IDs of standby databases located in Autonomous Data Guard remote + regions that are associated with the source database. Note that for Autonomous Database + Serverless instances, standby databases located in the same region as the source primary + database do not have Azure IDs.""" + peer_db_id: Optional[str] = rest_field(name="peerDbId", visibility=["update"]) + """The Azure resource ID of the Disaster Recovery peer database, which is located in a different + region from the current peer database.""" + is_local_data_guard_enabled: Optional[bool] = rest_field( + name="isLocalDataGuardEnabled", visibility=["read", "create", "update"] + ) + """Indicates whether the Autonomous Database has local or called in-region Data Guard enabled.""" + is_remote_data_guard_enabled: Optional[bool] = rest_field(name="isRemoteDataGuardEnabled", visibility=["read"]) + """Indicates whether the Autonomous Database has Cross Region Data Guard enabled.""" + local_disaster_recovery_type: Optional[Union[str, "_models.DisasterRecoveryType"]] = rest_field( + name="localDisasterRecoveryType", visibility=["read"] + ) + """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\".""" + time_disaster_recovery_role_changed: Optional[datetime.datetime] = rest_field( + name="timeDisasterRecoveryRoleChanged", visibility=["read"], format="rfc3339" + ) + """The date and time the Disaster Recovery role was switched for the standby Autonomous Database.""" + remote_disaster_recovery_configuration: Optional["_models.DisasterRecoveryConfigurationDetails"] = rest_field( + name="remoteDisasterRecoveryConfiguration", visibility=["read"] + ) + """Indicates remote disaster recovery configuration.""" + local_standby_db: Optional["_models.AutonomousDatabaseStandbySummary"] = rest_field( + name="localStandbyDb", visibility=["read"] + ) + """Local Autonomous Disaster Recovery standby database details.""" + failed_data_recovery_in_seconds: Optional[int] = rest_field(name="failedDataRecoveryInSeconds", visibility=["read"]) + """Indicates the number of seconds of data loss for a Data Guard failover.""" + is_mtls_connection_required: Optional[bool] = rest_field( + name="isMtlsConnectionRequired", visibility=["read", "create", "update"] + ) + """Specifies if the Autonomous Database requires mTLS connections.""" + is_preview_version_with_service_terms_accepted: Optional[bool] = rest_field( + name="isPreviewVersionWithServiceTermsAccepted", visibility=["create"] + ) + """Specifies if the Autonomous Database preview version is being provisioned.""" + license_model: Optional[Union[str, "_models.LicenseModel"]] = rest_field( + name="licenseModel", visibility=["read", "create", "update"] + ) + """The Oracle license model that applies to the Oracle Autonomous Database. The default is + LICENSE_INCLUDED. Known values are: \"LicenseIncluded\" and \"BringYourOwnLicense\".""" + ncharacter_set: Optional[str] = rest_field(name="ncharacterSet", visibility=["read", "create"]) + """The character set for the Autonomous Database.""" + lifecycle_details: Optional[str] = rest_field(name="lifecycleDetails", visibility=["read"]) + """Additional information about the current lifecycle state.""" + provisioning_state: Optional[Union[str, "_models.AzureResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Azure resource provisioning state. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", + and \"Provisioning\".""" + lifecycle_state: Optional[Union[str, "_models.AutonomousDatabaseLifecycleState"]] = rest_field( + name="lifecycleState", visibility=["read"] + ) + """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\".""" + scheduled_operations: Optional["_models.ScheduledOperationsType"] = rest_field( + name="scheduledOperations", visibility=["read", "create", "update"] + ) + """The list of scheduled operations.""" + private_endpoint_ip: Optional[str] = rest_field(name="privateEndpointIp", visibility=["read", "create"]) + """The private endpoint Ip address for the resource.""" + private_endpoint_label: Optional[str] = rest_field(name="privateEndpointLabel", visibility=["read", "create"]) + """The resource's private endpoint label.""" + oci_url: Optional[str] = rest_field(name="ociUrl", visibility=["read"]) + """HTTPS link to OCI resources exposed to Azure Customer via Azure Interface.""" + subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read", "create"]) + """Client subnet.""" + vnet_id: Optional[str] = rest_field(name="vnetId", visibility=["read", "create"]) + """VNET for network connectivity.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """The date and time that the database was created.""" + time_maintenance_begin: Optional[datetime.datetime] = rest_field( + name="timeMaintenanceBegin", visibility=["read"], format="rfc3339" + ) + """The date and time when maintenance will begin.""" + time_maintenance_end: Optional[datetime.datetime] = rest_field( + name="timeMaintenanceEnd", visibility=["read"], format="rfc3339" + ) + """The date and time when maintenance will end.""" + actual_used_data_storage_size_in_tbs: Optional[float] = rest_field( + name="actualUsedDataStorageSizeInTbs", visibility=["read"] + ) + """The current amount of storage in use for user and system data, in terabytes (TB).""" + allocated_storage_size_in_tbs: Optional[float] = rest_field(name="allocatedStorageSizeInTbs", visibility=["read"]) + """The amount of storage currently allocated for the database tables and billed for, rounded up.""" + apex_details: Optional["_models.ApexDetailsType"] = rest_field(name="apexDetails", visibility=["read"]) + """Information about Oracle APEX Application Development.""" + available_upgrade_versions: Optional[List[str]] = rest_field(name="availableUpgradeVersions", visibility=["read"]) + """List of Oracle Database versions available for a database upgrade. If there are no version + upgrades available, this list is empty.""" + connection_strings: Optional["_models.ConnectionStringType"] = rest_field( + name="connectionStrings", visibility=["read"] + ) + """The connection string used to connect to the Autonomous Database.""" + connection_urls: Optional["_models.ConnectionUrlType"] = rest_field(name="connectionUrls", visibility=["read"]) + """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.""" + data_safe_status: Optional[Union[str, "_models.DataSafeStatusType"]] = rest_field( + name="dataSafeStatus", visibility=["read"] + ) + """Status of the Data Safe registration for this Autonomous Database. Known values are: + \"Registering\", \"Registered\", \"Deregistering\", \"NotRegistered\", and \"Failed\".""" + database_edition: Optional[Union[str, "_models.DatabaseEditionType"]] = rest_field( + name="databaseEdition", visibility=["read", "create", "update"] + ) + """The Oracle Database Edition that applies to the Autonomous databases. Known values are: + \"StandardEdition\" and \"EnterpriseEdition\".""" + autonomous_database_id: Optional[str] = rest_field(name="autonomousDatabaseId", visibility=["read", "create"]) + """Autonomous Database ID.""" + in_memory_area_in_gbs: Optional[int] = rest_field(name="inMemoryAreaInGbs", visibility=["read"]) + """The area assigned to In-Memory tables in Autonomous Database.""" + next_long_term_backup_time_stamp: Optional[datetime.datetime] = rest_field( + name="nextLongTermBackupTimeStamp", visibility=["read"], format="rfc3339" + ) + """The date and time when the next long-term backup would be created.""" + long_term_backup_schedule: Optional["_models.LongTermBackUpScheduleDetails"] = rest_field( + name="longTermBackupSchedule", visibility=["read", "update"] + ) + """Details for the long-term backup schedule.""" + is_preview: Optional[bool] = rest_field(name="isPreview", visibility=["read"]) + """Indicates if the Autonomous Database version is a preview version.""" + local_adg_auto_failover_max_data_loss_limit: Optional[int] = rest_field( + name="localAdgAutoFailoverMaxDataLossLimit", visibility=["read", "update"] + ) + """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.""" + memory_per_oracle_compute_unit_in_gbs: Optional[int] = rest_field( + name="memoryPerOracleComputeUnitInGbs", visibility=["read"] + ) + """The amount of memory (in GBs) enabled per ECPU or OCPU.""" + open_mode: Optional[Union[str, "_models.OpenModeType"]] = rest_field(name="openMode", visibility=["read", "update"]) + """Indicates the Autonomous Database mode. Known values are: \"ReadOnly\" and \"ReadWrite\".""" + operations_insights_status: Optional[Union[str, "_models.OperationsInsightsStatusType"]] = rest_field( + name="operationsInsightsStatus", visibility=["read"] + ) + """Status of Operations Insights for this Autonomous Database. Known values are: \"Enabling\", + \"Enabled\", \"Disabling\", \"NotEnabled\", \"FailedEnabling\", and \"FailedDisabling\".""" + permission_level: Optional[Union[str, "_models.PermissionLevelType"]] = rest_field( + name="permissionLevel", visibility=["read", "update"] + ) + """The Autonomous Database permission level. Known values are: \"Restricted\" and + \"Unrestricted\".""" + private_endpoint: Optional[str] = rest_field(name="privateEndpoint", visibility=["read"]) + """The private endpoint for the resource.""" + provisionable_cpus: Optional[List[int]] = rest_field(name="provisionableCpus", visibility=["read"]) + """An array of CPU values that an Autonomous Database can be scaled to.""" + role: Optional[Union[str, "_models.RoleType"]] = rest_field(visibility=["read", "update"]) + """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\".""" + service_console_url: Optional[str] = rest_field(name="serviceConsoleUrl", visibility=["read"]) + """The URL of the Service Console for the Autonomous Database.""" + sql_web_developer_url: Optional[str] = rest_field(name="sqlWebDeveloperUrl", visibility=["read"]) + """The SQL Web Developer URL for the Oracle Autonomous Database.""" + supported_regions_to_clone_to: Optional[List[str]] = rest_field( + name="supportedRegionsToCloneTo", visibility=["read"] + ) + """The list of regions that support the creation of an Autonomous Database clone or an Autonomous + Data Guard standby database.""" + time_data_guard_role_changed: Optional[str] = rest_field(name="timeDataGuardRoleChanged", visibility=["read"]) + """The date and time the Autonomous Data Guard role was switched for the Autonomous Database.""" + time_deletion_of_free_autonomous_database: Optional[str] = rest_field( + name="timeDeletionOfFreeAutonomousDatabase", visibility=["read"] + ) + """The date and time the Always Free database will be automatically deleted because of inactivity.""" + time_local_data_guard_enabled: Optional[str] = rest_field(name="timeLocalDataGuardEnabled", visibility=["read"]) + """The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the + standby was provisioned in the same region as the primary database.""" + time_of_last_failover: Optional[str] = rest_field(name="timeOfLastFailover", visibility=["read"]) + """The timestamp of the last failover operation.""" + time_of_last_refresh: Optional[str] = rest_field(name="timeOfLastRefresh", visibility=["read"]) + """The date and time when last refresh happened.""" + time_of_last_refresh_point: Optional[str] = rest_field(name="timeOfLastRefreshPoint", visibility=["read"]) + """The refresh point timestamp (UTC).""" + time_of_last_switchover: Optional[str] = rest_field(name="timeOfLastSwitchover", visibility=["read"]) + """The timestamp of the last switchover operation for the Autonomous Database.""" + time_reclamation_of_free_autonomous_database: Optional[str] = rest_field( + name="timeReclamationOfFreeAutonomousDatabase", visibility=["read"] + ) + """The date and time the Always Free database will be stopped because of inactivity.""" + used_data_storage_size_in_gbs: Optional[int] = rest_field(name="usedDataStorageSizeInGbs", visibility=["read"]) + """The storage space consumed by Autonomous Database in GBs.""" + used_data_storage_size_in_tbs: Optional[int] = rest_field(name="usedDataStorageSizeInTbs", visibility=["read"]) + """The amount of storage that has been used, in terabytes.""" + ocid: Optional[str] = rest_field(visibility=["read"]) + """Database ocid.""" + backup_retention_period_in_days: Optional[int] = rest_field( + name="backupRetentionPeriodInDays", visibility=["read", "create", "update"] + ) + """Retention period, in days, for long-term backups.""" + whitelisted_ips: Optional[List[str]] = rest_field(name="whitelistedIps", visibility=["read", "create", "update"]) + """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'].""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + data_base_type: str, + 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, + long_term_backup_schedule: Optional["_models.LongTermBackUpScheduleDetails"] = 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseCharacterSet(ProxyResource): + """AutonomousDatabaseCharacterSets resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.AutonomousDatabaseCharacterSetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AutonomousDatabaseCharacterSetProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseCharacterSetProperties(_model_base.Model): + """AutonomousDatabaseCharacterSet resource model. + + :ivar character_set: The Oracle Autonomous Database supported character sets. Required. + :vartype character_set: str + """ + + character_set: str = rest_field(name="characterSet", visibility=["read", "create", "update", "delete", "query"]) + """The Oracle Autonomous Database supported character sets. Required.""" + + @overload + def __init__( + self, + *, + character_set: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseCloneProperties(AutonomousDatabaseBaseProperties, discriminator="Clone"): + """Autonomous Database clone resource model. + + :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 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 Azure resource IDs of standby databases located in Autonomous + Data Guard remote regions that are associated with the source database. Note that for + Autonomous Database Serverless instances, standby databases located in the same region as the + source primary database do not have Azure IDs. + :vartype peer_db_ids: list[str] + :ivar peer_db_id: The Azure resource ID 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 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: ~datetime.datetime + :ivar remote_disaster_recovery_configuration: Indicates remote disaster recovery configuration. + :vartype remote_disaster_recovery_configuration: + ~azure.mgmt.oracledatabase.models.DisasterRecoveryConfigurationDetails + :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 next_long_term_backup_time_stamp: The date and time when the next long-term backup would + be created. + :vartype next_long_term_backup_time_stamp: ~datetime.datetime + :ivar long_term_backup_schedule: Details for the long-term backup schedule. + :vartype long_term_backup_schedule: + ~azure.mgmt.oracledatabase.models.LongTermBackUpScheduleDetails + :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 data_base_type: Database type to be created. Required. Clone DB + :vartype data_base_type: str or ~azure.mgmt.oracledatabase.models.CLONE + :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 resource 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 + """ + + data_base_type: Literal[DataBaseType.CLONE] = rest_discriminator(name="dataBaseType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Database type to be created. Required. Clone DB""" + source: Optional[Union[str, "_models.SourceType"]] = rest_field(visibility=["create"]) + """The source of the database. Known values are: \"None\", \"Database\", \"BackupFromId\", + \"BackupFromTimestamp\", \"CloneToRefreshable\", \"CrossRegionDataguard\", and + \"CrossRegionDisasterRecovery\".""" + source_id: str = rest_field(name="sourceId", visibility=["read", "create"]) + """The Azure resource ID of the Autonomous Database that was cloned to create the current + Autonomous Database. Required.""" + clone_type: Union[str, "_models.CloneType"] = rest_field(name="cloneType", visibility=["create"]) + """The Autonomous Database clone type. Required. Known values are: \"Full\" and \"Metadata\".""" + is_reconnect_clone_enabled: Optional[bool] = rest_field(name="isReconnectCloneEnabled", visibility=["read"]) + """Indicates if the refreshable clone can be reconnected to its source database.""" + is_refreshable_clone: Optional[bool] = rest_field(name="isRefreshableClone", visibility=["read"]) + """Indicates if the Autonomous Database is a refreshable clone.""" + refreshable_model: Optional[Union[str, "_models.RefreshableModelType"]] = rest_field( + name="refreshableModel", visibility=["create"] + ) + """The refresh mode of the clone. Known values are: \"Automatic\" and \"Manual\".""" + refreshable_status: Optional[Union[str, "_models.RefreshableStatusType"]] = rest_field( + name="refreshableStatus", visibility=["read"] + ) + """The refresh status of the clone. Known values are: \"Refreshing\" and \"NotRefreshing\".""" + time_until_reconnect_clone_enabled: Optional[str] = rest_field( + name="timeUntilReconnectCloneEnabled", visibility=["read", "update"] + ) + """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.""" + + @overload + 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, + long_term_backup_schedule: Optional["_models.LongTermBackUpScheduleDetails"] = 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, data_base_type=DataBaseType.CLONE, **kwargs) + + +class AutonomousDatabaseCrossRegionDisasterRecoveryProperties( + AutonomousDatabaseBaseProperties, discriminator="CrossRegionDisasterRecovery" +): # pylint: disable=name-too-long + """Autonomous Database Cross Region Disaster Recovery resource model. + + :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 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 Azure resource IDs of standby databases located in Autonomous + Data Guard remote regions that are associated with the source database. Note that for + Autonomous Database Serverless instances, standby databases located in the same region as the + source primary database do not have Azure IDs. + :vartype peer_db_ids: list[str] + :ivar peer_db_id: The Azure resource ID 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 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: ~datetime.datetime + :ivar remote_disaster_recovery_configuration: Indicates remote disaster recovery configuration. + :vartype remote_disaster_recovery_configuration: + ~azure.mgmt.oracledatabase.models.DisasterRecoveryConfigurationDetails + :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 next_long_term_backup_time_stamp: The date and time when the next long-term backup would + be created. + :vartype next_long_term_backup_time_stamp: ~datetime.datetime + :ivar long_term_backup_schedule: Details for the long-term backup schedule. + :vartype long_term_backup_schedule: + ~azure.mgmt.oracledatabase.models.LongTermBackUpScheduleDetails + :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 data_base_type: Database type to be created. Required. Cross Region Disaster Recovery + :vartype data_base_type: str or + ~azure.mgmt.oracledatabase.models.CROSS_REGION_DISASTER_RECOVERY + :ivar source: The source of the database. Required. cross region disaster recovery source + :vartype source: str or ~azure.mgmt.oracledatabase.models.CROSS_REGION_DISASTER_RECOVERY + :ivar source_id: The Azure ID of the source Autonomous Database that will be used to create a + new peer database for the DR association. Required. + :vartype source_id: str + :ivar source_location: The name of the region where source Autonomous Database exists. + :vartype source_location: str + :ivar source_ocid: The source database ocid. + :vartype source_ocid: str + :ivar remote_disaster_recovery_type: Indicates the cross-region disaster recovery (DR) type of + the standby Autonomous Database Serverless instance. Autonomous Data Guard (ADG) DR type + provides business critical DR with a faster recovery time objective (RTO) during failover or + switchover. Backup-based DR type provides lower cost DR with a slower RTO during failover or + switchover. Required. Known values are: "Adg" and "BackupBased". + :vartype remote_disaster_recovery_type: str or + ~azure.mgmt.oracledatabase.models.DisasterRecoveryType + :ivar is_replicate_automatic_backups: If true, 7 days worth of backups are replicated across + regions for Cross-Region ADB or Backup-Based DR between Primary and Standby. If false, the + backups taken on the Primary are not replicated to the Standby database. + :vartype is_replicate_automatic_backups: bool + """ + + data_base_type: Literal[DataBaseType.CROSS_REGION_DISASTER_RECOVERY] = rest_discriminator(name="dataBaseType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Database type to be created. Required. Cross Region Disaster Recovery""" + source: Literal[SourceType.CROSS_REGION_DISASTER_RECOVERY] = rest_field(visibility=["create"]) + """The source of the database. Required. cross region disaster recovery source""" + source_id: str = rest_field(name="sourceId", visibility=["read", "create"]) + """The Azure ID of the source Autonomous Database that will be used to create a new peer database + for the DR association. Required.""" + source_location: Optional[str] = rest_field(name="sourceLocation", visibility=["create"]) + """The name of the region where source Autonomous Database exists.""" + source_ocid: Optional[str] = rest_field(name="sourceOcid", visibility=["create"]) + """The source database ocid.""" + remote_disaster_recovery_type: Union[str, "_models.DisasterRecoveryType"] = rest_field( + name="remoteDisasterRecoveryType", visibility=["read", "create"] + ) + """Indicates the cross-region disaster recovery (DR) type of the standby Autonomous Database + Serverless instance. Autonomous Data Guard (ADG) DR type provides business critical DR with a + faster recovery time objective (RTO) during failover or switchover. Backup-based DR type + provides lower cost DR with a slower RTO during failover or switchover. Required. Known values + are: \"Adg\" and \"BackupBased\".""" + is_replicate_automatic_backups: Optional[bool] = rest_field( + name="isReplicateAutomaticBackups", visibility=["read", "create"] + ) + """If true, 7 days worth of backups are replicated across regions for Cross-Region ADB or + Backup-Based DR between Primary and Standby. If false, the backups taken on the Primary are not + replicated to the Standby database.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + source: Literal[SourceType.CROSS_REGION_DISASTER_RECOVERY], + source_id: str, + remote_disaster_recovery_type: Union[str, "_models.DisasterRecoveryType"], + 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, + long_term_backup_schedule: Optional["_models.LongTermBackUpScheduleDetails"] = 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_location: Optional[str] = None, + source_ocid: Optional[str] = None, + is_replicate_automatic_backups: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, data_base_type=DataBaseType.CROSS_REGION_DISASTER_RECOVERY, **kwargs) + + +class AutonomousDatabaseFromBackupTimestampProperties( + AutonomousDatabaseBaseProperties, discriminator="CloneFromBackupTimestamp" +): # pylint: disable=name-too-long + """Autonomous Database From Backup Timestamp resource model. + + :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 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 Azure resource IDs of standby databases located in Autonomous + Data Guard remote regions that are associated with the source database. Note that for + Autonomous Database Serverless instances, standby databases located in the same region as the + source primary database do not have Azure IDs. + :vartype peer_db_ids: list[str] + :ivar peer_db_id: The Azure resource ID 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 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: ~datetime.datetime + :ivar remote_disaster_recovery_configuration: Indicates remote disaster recovery configuration. + :vartype remote_disaster_recovery_configuration: + ~azure.mgmt.oracledatabase.models.DisasterRecoveryConfigurationDetails + :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 next_long_term_backup_time_stamp: The date and time when the next long-term backup would + be created. + :vartype next_long_term_backup_time_stamp: ~datetime.datetime + :ivar long_term_backup_schedule: Details for the long-term backup schedule. + :vartype long_term_backup_schedule: + ~azure.mgmt.oracledatabase.models.LongTermBackUpScheduleDetails + :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 data_base_type: Database type to be created. Required. Clone DB from backup timestamp + :vartype data_base_type: str or ~azure.mgmt.oracledatabase.models.CLONE_FROM_BACKUP_TIMESTAMP + :ivar source: The source of the database. Required. Backup from timestamp source + :vartype source: str or ~azure.mgmt.oracledatabase.models.BACKUP_FROM_TIMESTAMP + :ivar source_id: The ID of the source Autonomous Database that you will clone to create a new + 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 timestamp: The timestamp specified for the point-in-time clone of the source Autonomous + Database. The timestamp must be in the past. + :vartype timestamp: ~datetime.datetime + :ivar use_latest_available_backup_time_stamp: Clone from latest available backup timestamp. + :vartype use_latest_available_backup_time_stamp: bool + """ + + data_base_type: Literal[DataBaseType.CLONE_FROM_BACKUP_TIMESTAMP] = rest_discriminator(name="dataBaseType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Database type to be created. Required. Clone DB from backup timestamp""" + source: Literal[SourceType.BACKUP_FROM_TIMESTAMP] = rest_field(visibility=["create"]) + """The source of the database. Required. Backup from timestamp source""" + source_id: str = rest_field(name="sourceId", visibility=["read", "create"]) + """The ID of the source Autonomous Database that you will clone to create a new Autonomous + Database. Required.""" + clone_type: Union[str, "_models.CloneType"] = rest_field(name="cloneType", visibility=["create"]) + """The Autonomous Database clone type. Required. Known values are: \"Full\" and \"Metadata\".""" + timestamp: Optional[datetime.datetime] = rest_field(visibility=["create"], format="rfc3339") + """The timestamp specified for the point-in-time clone of the source Autonomous Database. The + timestamp must be in the past.""" + use_latest_available_backup_time_stamp: Optional[bool] = rest_field( + name="useLatestAvailableBackupTimeStamp", visibility=["create"] + ) + """Clone from latest available backup timestamp.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + source: Literal[SourceType.BACKUP_FROM_TIMESTAMP], + 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, + long_term_backup_schedule: Optional["_models.LongTermBackUpScheduleDetails"] = 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, + timestamp: Optional[datetime.datetime] = None, + use_latest_available_backup_time_stamp: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, data_base_type=DataBaseType.CLONE_FROM_BACKUP_TIMESTAMP, **kwargs) + + +class AutonomousDatabaseNationalCharacterSet(ProxyResource): + """AutonomousDatabaseNationalCharacterSets resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.AutonomousDatabaseNationalCharacterSetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AutonomousDatabaseNationalCharacterSetProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseNationalCharacterSetProperties(_model_base.Model): # pylint: disable=name-too-long + """AutonomousDatabaseNationalCharacterSet resource model. + + :ivar character_set: The Oracle Autonomous Database supported national character sets. + Required. + :vartype character_set: str + """ + + character_set: str = rest_field(name="characterSet", visibility=["read", "create", "update", "delete", "query"]) + """The Oracle Autonomous Database supported national character sets. Required.""" + + @overload + def __init__( + self, + *, + character_set: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseProperties(AutonomousDatabaseBaseProperties, discriminator="Regular"): + """Autonomous Database resource model. + + :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 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 Azure resource IDs of standby databases located in Autonomous + Data Guard remote regions that are associated with the source database. Note that for + Autonomous Database Serverless instances, standby databases located in the same region as the + source primary database do not have Azure IDs. + :vartype peer_db_ids: list[str] + :ivar peer_db_id: The Azure resource ID 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 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: ~datetime.datetime + :ivar remote_disaster_recovery_configuration: Indicates remote disaster recovery configuration. + :vartype remote_disaster_recovery_configuration: + ~azure.mgmt.oracledatabase.models.DisasterRecoveryConfigurationDetails + :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 next_long_term_backup_time_stamp: The date and time when the next long-term backup would + be created. + :vartype next_long_term_backup_time_stamp: ~datetime.datetime + :ivar long_term_backup_schedule: Details for the long-term backup schedule. + :vartype long_term_backup_schedule: + ~azure.mgmt.oracledatabase.models.LongTermBackUpScheduleDetails + :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 data_base_type: Database type to be created. Required. Regular DB + :vartype data_base_type: str or ~azure.mgmt.oracledatabase.models.REGULAR + """ + + data_base_type: Literal[DataBaseType.REGULAR] = rest_discriminator(name="dataBaseType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Database type to be created. Required. Regular DB""" + + @overload + 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, + long_term_backup_schedule: Optional["_models.LongTermBackUpScheduleDetails"] = 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, data_base_type=DataBaseType.REGULAR, **kwargs) + + +class AutonomousDatabaseStandbySummary(_model_base.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 + """ + + lag_time_in_seconds: Optional[int] = rest_field( + name="lagTimeInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + lifecycle_state: Optional[Union[str, "_models.AutonomousDatabaseLifecycleState"]] = rest_field( + name="lifecycleState", visibility=["read", "create", "update", "delete", "query"] + ) + """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\".""" + lifecycle_details: Optional[str] = rest_field( + name="lifecycleDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional information about the current lifecycle state.""" + time_data_guard_role_changed: Optional[str] = rest_field( + name="timeDataGuardRoleChanged", visibility=["read", "create", "update", "delete", "query"] + ) + """The date and time the Autonomous Data Guard role was switched for the standby Autonomous + Database.""" + time_disaster_recovery_role_changed: Optional[str] = rest_field( + name="timeDisasterRecoveryRoleChanged", visibility=["read", "create", "update", "delete", "query"] + ) + """The date and time the Disaster Recovery role was switched for the standby Autonomous Database.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseUpdate(_model_base.Model): + """The type used for update operations of the AutonomousDatabase. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdateProperties + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.AutonomousDatabaseUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AutonomousDatabaseUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseUpdateProperties(_model_base.Model): + """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 Azure resource ID 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.ScheduledOperationsType + :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 long_term_backup_schedule: Details for the long-term backup schedule. + :vartype long_term_backup_schedule: + ~azure.mgmt.oracledatabase.models.LongTermBackUpScheduleDetails + :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] + """ + + admin_password: Optional[str] = rest_field(name="adminPassword", visibility=["create", "update"]) + """Admin password.""" + autonomous_maintenance_schedule_type: Optional[Union[str, "_models.AutonomousMaintenanceScheduleType"]] = ( + rest_field(name="autonomousMaintenanceScheduleType", visibility=["read", "create", "update"]) + ) + """The maintenance schedule type of the Autonomous Database Serverless. Known values are: + \"Early\" and \"Regular\".""" + compute_count: Optional[float] = rest_field(name="computeCount", visibility=["read", "create", "update"]) + """The compute amount (CPUs) available to the database.""" + cpu_core_count: Optional[int] = rest_field(name="cpuCoreCount", visibility=["read", "create", "update"]) + """The number of CPU cores to be made available to the database.""" + customer_contacts: Optional[List["_models.CustomerContact"]] = rest_field( + name="customerContacts", visibility=["read", "create", "update"] + ) + """Customer Contacts.""" + data_storage_size_in_tbs: Optional[int] = rest_field( + name="dataStorageSizeInTbs", visibility=["read", "create", "update"] + ) + """The quantity of data in the database, in terabytes.""" + data_storage_size_in_gbs: Optional[int] = rest_field( + name="dataStorageSizeInGbs", visibility=["read", "create", "update"] + ) + """The size, in gigabytes, of the data volume that will be created and attached to the database.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read", "create", "update"]) + """The user-friendly name for the Autonomous Database.""" + is_auto_scaling_enabled: Optional[bool] = rest_field( + name="isAutoScalingEnabled", visibility=["read", "create", "update"] + ) + """Indicates if auto scaling is enabled for the Autonomous Database CPU core count.""" + is_auto_scaling_for_storage_enabled: Optional[bool] = rest_field( + name="isAutoScalingForStorageEnabled", visibility=["read", "create", "update"] + ) + """Indicates if auto scaling is enabled for the Autonomous Database storage.""" + peer_db_id: Optional[str] = rest_field(name="peerDbId", visibility=["update"]) + """The Azure resource ID of the Disaster Recovery peer database, which is located in a different + region from the current peer database.""" + is_local_data_guard_enabled: Optional[bool] = rest_field( + name="isLocalDataGuardEnabled", visibility=["read", "create", "update"] + ) + """Indicates whether the Autonomous Database has local or called in-region Data Guard enabled.""" + is_mtls_connection_required: Optional[bool] = rest_field( + name="isMtlsConnectionRequired", visibility=["read", "create", "update"] + ) + """Specifies if the Autonomous Database requires mTLS connections.""" + license_model: Optional[Union[str, "_models.LicenseModel"]] = rest_field( + name="licenseModel", visibility=["read", "create", "update"] + ) + """The Oracle license model that applies to the Oracle Autonomous Database. The default is + LICENSE_INCLUDED. Known values are: \"LicenseIncluded\" and \"BringYourOwnLicense\".""" + scheduled_operations: Optional["_models.ScheduledOperationsType"] = rest_field( + name="scheduledOperations", visibility=["read", "create", "update"] + ) + """The list of scheduled operations.""" + database_edition: Optional[Union[str, "_models.DatabaseEditionType"]] = rest_field( + name="databaseEdition", visibility=["read", "create", "update"] + ) + """The Oracle Database Edition that applies to the Autonomous databases. Known values are: + \"StandardEdition\" and \"EnterpriseEdition\".""" + long_term_backup_schedule: Optional["_models.LongTermBackUpScheduleDetails"] = rest_field( + name="longTermBackupSchedule", visibility=["read", "update"] + ) + """Details for the long-term backup schedule.""" + local_adg_auto_failover_max_data_loss_limit: Optional[int] = rest_field( + name="localAdgAutoFailoverMaxDataLossLimit", visibility=["read", "update"] + ) + """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.""" + open_mode: Optional[Union[str, "_models.OpenModeType"]] = rest_field(name="openMode", visibility=["read", "update"]) + """Indicates the Autonomous Database mode. Known values are: \"ReadOnly\" and \"ReadWrite\".""" + permission_level: Optional[Union[str, "_models.PermissionLevelType"]] = rest_field( + name="permissionLevel", visibility=["read", "update"] + ) + """The Autonomous Database permission level. Known values are: \"Restricted\" and + \"Unrestricted\".""" + role: Optional[Union[str, "_models.RoleType"]] = rest_field(visibility=["read", "update"]) + """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\".""" + backup_retention_period_in_days: Optional[int] = rest_field( + name="backupRetentionPeriodInDays", visibility=["read", "create", "update"] + ) + """Retention period, in days, for long-term backups.""" + whitelisted_ips: Optional[List[str]] = rest_field(name="whitelistedIps", visibility=["read", "create", "update"]) + """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'].""" + + @overload + 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.ScheduledOperationsType"] = None, + database_edition: Optional[Union[str, "_models.DatabaseEditionType"]] = None, + long_term_backup_schedule: Optional["_models.LongTermBackUpScheduleDetails"] = 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDatabaseWalletFile(_model_base.Model): + """Autonomous Database Wallet File resource model. + + :ivar wallet_files: The base64 encoded wallet files. Required. + :vartype wallet_files: str + """ + + wallet_files: str = rest_field(name="walletFiles", visibility=["read", "create", "update", "delete", "query"]) + """The base64 encoded wallet files. Required.""" + + @overload + def __init__( + self, + *, + wallet_files: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDbVersion(ProxyResource): + """AutonomousDbVersion resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.AutonomousDbVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AutonomousDbVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutonomousDbVersionProperties(_model_base.Model): + """AutonomousDbVersion resource model. + + :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 + """ + + version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Supported Autonomous Db versions. Required.""" + db_workload: Optional[Union[str, "_models.WorkloadType"]] = rest_field( + name="dbWorkload", visibility=["read", "create", "update", "delete", "query"] + ) + """The Autonomous Database workload type. Known values are: \"OLTP\", \"DW\", \"AJD\", and + \"APEX\".""" + is_default_for_free: Optional[bool] = rest_field( + name="isDefaultForFree", visibility=["read", "create", "update", "delete", "query"] + ) + """True if this version of the Oracle Database software's default is free.""" + is_default_for_paid: Optional[bool] = rest_field( + name="isDefaultForPaid", visibility=["read", "create", "update", "delete", "query"] + ) + """True if this version of the Oracle Database software's default is paid.""" + is_free_tier_enabled: Optional[bool] = rest_field( + name="isFreeTierEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """True if this version of the Oracle Database software can be used for Always-Free Autonomous + Databases.""" + is_paid_enabled: Optional[bool] = rest_field( + name="isPaidEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """True if this version of the Oracle Database software has payments enabled.""" + + @overload + def __init__( + self, + *, + version: str, + db_workload: Optional[Union[str, "_models.WorkloadType"]] = None, + is_default_for_free: Optional[bool] = None, + is_default_for_paid: Optional[bool] = None, + is_free_tier_enabled: Optional[bool] = None, + is_paid_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureSubscriptions(_model_base.Model): + """Azure Subscriptions model. + + :ivar azure_subscription_ids: Azure Subscription Ids to be updated. Required. + :vartype azure_subscription_ids: list[str] + """ + + azure_subscription_ids: List[str] = rest_field( + name="azureSubscriptionIds", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure Subscription Ids to be updated. Required.""" + + @overload + def __init__( + self, + *, + azure_subscription_ids: List[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudExadataInfrastructure(TrackedResource): + """CloudExadataInfrastructure resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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] + """ + + properties: Optional["_models.CloudExadataInfrastructureProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + zones: List[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """CloudExadataInfrastructure zones. Required.""" + + @overload + def __init__( + self, + *, + location: str, + zones: List[str], + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CloudExadataInfrastructureProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudExadataInfrastructureProperties(_model_base.Model): + """CloudExadataInfrastructure resource model. + + :ivar defined_file_system_configuration: Defined file system configurations. + :vartype defined_file_system_configuration: + list[~azure.mgmt.oracledatabase.models.DefinedFileSystemConfiguration] + :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: float + :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 + :ivar database_server_type: The database server model type of the cloud Exadata infrastructure + resource. + :vartype database_server_type: str + :ivar storage_server_type: The storage server model type of the cloud Exadata infrastructure + resource. + :vartype storage_server_type: str + :ivar compute_model: The compute model of the Exadata Infrastructure. Known values are: "ECPU" + and "OCPU". + :vartype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + """ + + defined_file_system_configuration: Optional[List["_models.DefinedFileSystemConfiguration"]] = rest_field( + name="definedFileSystemConfiguration", visibility=["read"] + ) + """Defined file system configurations.""" + ocid: Optional[str] = rest_field(visibility=["read"]) + """Exadata infra ocid.""" + compute_count: Optional[int] = rest_field(name="computeCount", visibility=["read", "create", "update"]) + """The number of compute servers for the cloud Exadata infrastructure.""" + storage_count: Optional[int] = rest_field(name="storageCount", visibility=["read", "create", "update"]) + """The number of storage servers for the cloud Exadata infrastructure.""" + total_storage_size_in_gbs: Optional[int] = rest_field(name="totalStorageSizeInGbs", visibility=["read"]) + """The total storage allocated to the cloud Exadata infrastructure resource, in gigabytes (GB).""" + available_storage_size_in_gbs: Optional[int] = rest_field(name="availableStorageSizeInGbs", visibility=["read"]) + """The available storage can be allocated to the cloud Exadata infrastructure resource, in + gigabytes (GB).""" + time_created: Optional[str] = rest_field(name="timeCreated", visibility=["read"]) + """The date and time the cloud Exadata infrastructure resource was created.""" + lifecycle_details: Optional[str] = rest_field(name="lifecycleDetails", visibility=["read"]) + """Additional information about the current lifecycle state.""" + maintenance_window: Optional["_models.MaintenanceWindow"] = rest_field( + name="maintenanceWindow", visibility=["read", "create", "update"] + ) + """maintenanceWindow property.""" + estimated_patching_time: Optional["_models.EstimatedPatchingTime"] = rest_field( + name="estimatedPatchingTime", visibility=["read"] + ) + """The estimated total time required in minutes for all patching operations (database server, + storage server, and network switch patching).""" + customer_contacts: Optional[List["_models.CustomerContact"]] = rest_field( + name="customerContacts", visibility=["read", "create", "update"] + ) + """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.""" + provisioning_state: Optional[Union[str, "_models.AzureResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """CloudExadataInfrastructure provisioning state. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", and \"Provisioning\".""" + lifecycle_state: Optional[Union[str, "_models.CloudExadataInfrastructureLifecycleState"]] = rest_field( + name="lifecycleState", visibility=["read"] + ) + """CloudExadataInfrastructure lifecycle state. Known values are: \"Provisioning\", \"Available\", + \"Updating\", \"Terminating\", \"Terminated\", \"MaintenanceInProgress\", and \"Failed\".""" + shape: str = rest_field(visibility=["read", "create"]) + """The model name of the cloud Exadata infrastructure resource. Required.""" + oci_url: Optional[str] = rest_field(name="ociUrl", visibility=["read"]) + """HTTPS link to OCI resources exposed to Azure Customer via Azure Interface.""" + cpu_count: Optional[int] = rest_field(name="cpuCount", visibility=["read"]) + """The total number of CPU cores allocated.""" + max_cpu_count: Optional[int] = rest_field(name="maxCpuCount", visibility=["read"]) + """The total number of CPU cores available.""" + memory_size_in_gbs: Optional[int] = rest_field(name="memorySizeInGbs", visibility=["read"]) + """The memory allocated in GBs.""" + max_memory_in_gbs: Optional[int] = rest_field(name="maxMemoryInGbs", visibility=["read"]) + """The total memory available in GBs.""" + db_node_storage_size_in_gbs: Optional[int] = rest_field(name="dbNodeStorageSizeInGbs", visibility=["read"]) + """The local node storage to be allocated in GBs.""" + max_db_node_storage_size_in_gbs: Optional[int] = rest_field(name="maxDbNodeStorageSizeInGbs", visibility=["read"]) + """The total local node storage available in GBs.""" + data_storage_size_in_tbs: Optional[float] = rest_field(name="dataStorageSizeInTbs", visibility=["read"]) + """The quantity of data in the database, in terabytes.""" + max_data_storage_in_tbs: Optional[float] = rest_field(name="maxDataStorageInTbs", visibility=["read"]) + """The total available DATA disk group size.""" + db_server_version: Optional[str] = rest_field(name="dbServerVersion", visibility=["read"]) + """The software version of the database servers (dom0) in the Exadata infrastructure.""" + storage_server_version: Optional[str] = rest_field(name="storageServerVersion", visibility=["read"]) + """The software version of the storage servers (cells) in the Exadata infrastructure.""" + activated_storage_count: Optional[int] = rest_field(name="activatedStorageCount", visibility=["read"]) + """The requested number of additional storage servers activated for the Exadata infrastructure.""" + additional_storage_count: Optional[int] = rest_field(name="additionalStorageCount", visibility=["read"]) + """The requested number of additional storage servers for the Exadata infrastructure.""" + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update"]) + """The name for the Exadata infrastructure. Required.""" + last_maintenance_run_id: Optional[str] = rest_field(name="lastMaintenanceRunId", visibility=["read"]) + """The OCID of the last maintenance run.""" + next_maintenance_run_id: Optional[str] = rest_field(name="nextMaintenanceRunId", visibility=["read"]) + """The OCID of the next maintenance run.""" + monthly_db_server_version: Optional[str] = rest_field(name="monthlyDbServerVersion", visibility=["read"]) + """Monthly Db Server version.""" + monthly_storage_server_version: Optional[str] = rest_field(name="monthlyStorageServerVersion", visibility=["read"]) + """Monthly Storage Server version.""" + database_server_type: Optional[str] = rest_field(name="databaseServerType", visibility=["read", "create"]) + """The database server model type of the cloud Exadata infrastructure resource.""" + storage_server_type: Optional[str] = rest_field(name="storageServerType", visibility=["read", "create"]) + """The storage server model type of the cloud Exadata infrastructure resource.""" + compute_model: Optional[Union[str, "_models.ComputeModel"]] = rest_field(name="computeModel", visibility=["read"]) + """The compute model of the Exadata Infrastructure. Known values are: \"ECPU\" and \"OCPU\".""" + + @overload + 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, + database_server_type: Optional[str] = None, + storage_server_type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudExadataInfrastructureUpdate(_model_base.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 resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdateProperties + """ + + zones: Optional[List[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """CloudExadataInfrastructure zones.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.CloudExadataInfrastructureUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + zones: Optional[List[str]] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CloudExadataInfrastructureUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudExadataInfrastructureUpdateProperties(_model_base.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 + """ + + compute_count: Optional[int] = rest_field(name="computeCount", visibility=["read", "create", "update"]) + """The number of compute servers for the cloud Exadata infrastructure.""" + storage_count: Optional[int] = rest_field(name="storageCount", visibility=["read", "create", "update"]) + """The number of storage servers for the cloud Exadata infrastructure.""" + maintenance_window: Optional["_models.MaintenanceWindow"] = rest_field( + name="maintenanceWindow", visibility=["read", "create", "update"] + ) + """maintenanceWindow property.""" + customer_contacts: Optional[List["_models.CustomerContact"]] = rest_field( + name="customerContacts", visibility=["read", "create", "update"] + ) + """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.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read", "create", "update"]) + """The name for the Exadata infrastructure.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudVmCluster(TrackedResource): + """CloudVmCluster resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.CloudVmClusterProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CloudVmClusterProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudVmClusterProperties(_model_base.Model): + """CloudVmCluster resource model. + + :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 file_system_configuration_details: Array of mount path and size. + :vartype file_system_configuration_details: + list[~azure.mgmt.oracledatabase.models.FileSystemConfigurationDetails] + :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 + :ivar compute_model: The compute model of the VM Cluster. Known values are: "ECPU" and "OCPU". + :vartype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + """ + + ocid: Optional[str] = rest_field(visibility=["read"]) + """Cloud VM Cluster ocid.""" + listener_port: Optional[int] = rest_field(name="listenerPort", visibility=["read"]) + """The port number configured for the listener on the cloud VM cluster.""" + node_count: Optional[int] = rest_field(name="nodeCount", visibility=["read"]) + """The number of nodes in the cloud VM cluster.""" + storage_size_in_gbs: Optional[int] = rest_field(name="storageSizeInGbs", visibility=["read", "update"]) + """The data disk group size to be allocated in GBs per VM.""" + file_system_configuration_details: Optional[List["_models.FileSystemConfigurationDetails"]] = rest_field( + name="fileSystemConfigurationDetails", visibility=["read", "update"] + ) + """Array of mount path and size.""" + data_storage_size_in_tbs: Optional[float] = rest_field( + name="dataStorageSizeInTbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The data disk group size to be allocated in TBs.""" + db_node_storage_size_in_gbs: Optional[int] = rest_field( + name="dbNodeStorageSizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The local node storage to be allocated in GBs.""" + memory_size_in_gbs: Optional[int] = rest_field( + name="memorySizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The memory to be allocated in GBs.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """The date and time that the cloud VM cluster was created.""" + lifecycle_details: Optional[str] = rest_field(name="lifecycleDetails", visibility=["read"]) + """Additional information about the current lifecycle state.""" + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create"]) + """The time zone of the cloud VM cluster. For details, see `Exadata Infrastructure Time Zones + `_.""" + zone_id: Optional[str] = rest_field(name="zoneId", visibility=["read", "create"]) + """The OCID of the zone the cloud VM cluster is associated with.""" + hostname: str = rest_field(visibility=["read", "create"]) + """The hostname for the cloud VM cluster. Required.""" + domain: Optional[str] = rest_field(visibility=["read", "create"]) + """The domain name for the cloud VM cluster.""" + cpu_core_count: int = rest_field(name="cpuCoreCount", visibility=["read", "create", "update", "delete", "query"]) + """The number of CPU cores enabled on the cloud VM cluster. Required.""" + ocpu_count: Optional[float] = rest_field( + name="ocpuCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for + the fractional part.""" + cluster_name: Optional[str] = rest_field(name="clusterName", visibility=["read", "create"]) + """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.""" + data_storage_percentage: Optional[int] = rest_field(name="dataStoragePercentage", visibility=["read", "create"]) + """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.""" + is_local_backup_enabled: Optional[bool] = rest_field(name="isLocalBackupEnabled", visibility=["read", "create"]) + """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.""" + cloud_exadata_infrastructure_id: str = rest_field( + name="cloudExadataInfrastructureId", visibility=["read", "create"] + ) + """Cloud Exadata Infrastructure ID. Required.""" + is_sparse_diskgroup_enabled: Optional[bool] = rest_field( + name="isSparseDiskgroupEnabled", visibility=["read", "create"] + ) + """If true, sparse disk group is configured for the cloud VM cluster. If false, sparse disk group + is not created.""" + system_version: Optional[str] = rest_field(name="systemVersion", visibility=["read", "create"]) + """Operating system version of the image.""" + ssh_public_keys: List[str] = rest_field( + name="sshPublicKeys", visibility=["read", "create", "update", "delete", "query"] + ) + """The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. + Required.""" + license_model: Optional[Union[str, "_models.LicenseModel"]] = rest_field( + name="licenseModel", visibility=["read", "create", "update", "delete", "query"] + ) + """The Oracle license model that applies to the cloud VM cluster. The default is LICENSE_INCLUDED. + Known values are: \"LicenseIncluded\" and \"BringYourOwnLicense\".""" + disk_redundancy: Optional[Union[str, "_models.DiskRedundancy"]] = rest_field( + name="diskRedundancy", visibility=["read"] + ) + """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\".""" + scan_ip_ids: Optional[List[str]] = rest_field(name="scanIpIds", visibility=["read"]) + """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.""" + vip_ids: Optional[List[str]] = rest_field(name="vipIds", visibility=["read"]) + """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.""" + scan_dns_name: Optional[str] = rest_field(name="scanDnsName", visibility=["read"]) + """The FQDN of the DNS record for the SCAN IP addresses that are associated with the cloud VM + cluster.""" + scan_listener_port_tcp: Optional[int] = rest_field(name="scanListenerPortTcp", visibility=["read", "create"]) + """The TCP Single Client Access Name (SCAN) port. The default port is 1521.""" + scan_listener_port_tcp_ssl: Optional[int] = rest_field(name="scanListenerPortTcpSsl", visibility=["read", "create"]) + """The TCPS Single Client Access Name (SCAN) port. The default port is 2484.""" + scan_dns_record_id: Optional[str] = rest_field(name="scanDnsRecordId", visibility=["read"]) + """The OCID of the DNS record for the SCAN IP addresses that are associated with the cloud VM + cluster.""" + shape: Optional[str] = rest_field(visibility=["read"]) + """The model name of the Exadata hardware running the cloud VM cluster.""" + provisioning_state: Optional[Union[str, "_models.AzureResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """CloudVmCluster provisioning state. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", + and \"Provisioning\".""" + lifecycle_state: Optional[Union[str, "_models.CloudVmClusterLifecycleState"]] = rest_field( + name="lifecycleState", visibility=["read"] + ) + """CloudVmCluster lifecycle state. Known values are: \"Provisioning\", \"Available\", + \"Updating\", \"Terminating\", \"Terminated\", \"MaintenanceInProgress\", and \"Failed\".""" + vnet_id: str = rest_field(name="vnetId", visibility=["read", "create"]) + """VNET for network connectivity. Required.""" + gi_version: str = rest_field(name="giVersion", visibility=["read", "create"]) + """Oracle Grid Infrastructure (GI) software version. Required.""" + oci_url: Optional[str] = rest_field(name="ociUrl", visibility=["read"]) + """HTTPS link to OCI resources exposed to Azure Customer via Azure Interface.""" + nsg_url: Optional[str] = rest_field(name="nsgUrl", visibility=["read"]) + """HTTPS link to OCI Network Security Group exposed to Azure Customer via the Azure Interface.""" + subnet_id: str = rest_field(name="subnetId", visibility=["read", "create"]) + """Client subnet. Required.""" + backup_subnet_cidr: Optional[str] = rest_field(name="backupSubnetCidr", visibility=["read", "create"]) + """Client OCI backup subnet CIDR, default is 192.168.252.0/22.""" + nsg_cidrs: Optional[List["_models.NsgCidr"]] = rest_field(name="nsgCidrs", visibility=["read", "create"]) + """CIDR blocks for additional NSG ingress rules. The VNET CIDRs used to provision the VM Cluster + will be added by default.""" + data_collection_options: Optional["_models.DataCollectionOptions"] = rest_field( + name="dataCollectionOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates user preferences for the various diagnostic collection options for the VM + cluster/Cloud VM cluster/VMBM DBCS.""" + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """Display Name. Required.""" + compute_nodes: Optional[List[str]] = rest_field(name="computeNodes", visibility=["update"]) + """The list of compute servers to be added to the cloud VM cluster.""" + iorm_config_cache: Optional["_models.ExadataIormConfig"] = rest_field(name="iormConfigCache", visibility=["read"]) + """iormConfigCache details for cloud VM cluster.""" + last_update_history_entry_id: Optional[str] = rest_field(name="lastUpdateHistoryEntryId", visibility=["read"]) + """The OCID of the last maintenance update history entry.""" + db_servers: Optional[List[str]] = rest_field(name="dbServers", visibility=["read", "create"]) + """The list of DB servers.""" + compartment_id: Optional[str] = rest_field(name="compartmentId", visibility=["read"]) + """Cluster compartmentId.""" + subnet_ocid: Optional[str] = rest_field(name="subnetOcid", visibility=["read"]) + """Cluster subnet ocid.""" + compute_model: Optional[Union[str, "_models.ComputeModel"]] = rest_field(name="computeModel", visibility=["read"]) + """The compute model of the VM Cluster. Known values are: \"ECPU\" and \"OCPU\".""" + + @overload + 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, + file_system_configuration_details: Optional[List["_models.FileSystemConfigurationDetails"]] = 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: Optional[bool] = None, + is_sparse_diskgroup_enabled: Optional[bool] = None, + system_version: Optional[str] = None, + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudVmClusterUpdate(_model_base.Model): + """The type used for update operations of the CloudVmCluster. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterUpdateProperties + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.CloudVmClusterUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CloudVmClusterUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudVmClusterUpdateProperties(_model_base.Model): + """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 file_system_configuration_details: Array of mount path and size. + :vartype file_system_configuration_details: + list[~azure.mgmt.oracledatabase.models.FileSystemConfigurationDetails] + :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] + """ + + storage_size_in_gbs: Optional[int] = rest_field(name="storageSizeInGbs", visibility=["read", "update"]) + """The data disk group size to be allocated in GBs per VM.""" + file_system_configuration_details: Optional[List["_models.FileSystemConfigurationDetails"]] = rest_field( + name="fileSystemConfigurationDetails", visibility=["read", "update"] + ) + """Array of mount path and size.""" + data_storage_size_in_tbs: Optional[float] = rest_field( + name="dataStorageSizeInTbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The data disk group size to be allocated in TBs.""" + db_node_storage_size_in_gbs: Optional[int] = rest_field( + name="dbNodeStorageSizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The local node storage to be allocated in GBs.""" + memory_size_in_gbs: Optional[int] = rest_field( + name="memorySizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The memory to be allocated in GBs.""" + cpu_core_count: Optional[int] = rest_field( + name="cpuCoreCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of CPU cores enabled on the cloud VM cluster.""" + ocpu_count: Optional[float] = rest_field( + name="ocpuCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for + the fractional part.""" + ssh_public_keys: Optional[List[str]] = rest_field( + name="sshPublicKeys", visibility=["read", "create", "update", "delete", "query"] + ) + """The public key portion of one or more key pairs used for SSH access to the cloud VM cluster.""" + license_model: Optional[Union[str, "_models.LicenseModel"]] = rest_field( + name="licenseModel", visibility=["read", "create", "update", "delete", "query"] + ) + """The Oracle license model that applies to the cloud VM cluster. The default is LICENSE_INCLUDED. + Known values are: \"LicenseIncluded\" and \"BringYourOwnLicense\".""" + data_collection_options: Optional["_models.DataCollectionOptions"] = rest_field( + name="dataCollectionOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates user preferences for the various diagnostic collection options for the VM + cluster/Cloud VM cluster/VMBM DBCS.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Display Name.""" + compute_nodes: Optional[List[str]] = rest_field(name="computeNodes", visibility=["update"]) + """The list of compute servers to be added to the cloud VM cluster.""" + + @overload + def __init__( + self, + *, + storage_size_in_gbs: Optional[int] = None, + file_system_configuration_details: Optional[List["_models.FileSystemConfigurationDetails"]] = 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionStringType(_model_base.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] + """ + + all_connection_strings: Optional["_models.AllConnectionStringType"] = rest_field( + name="allConnectionStrings", visibility=["read", "create", "update", "delete", "query"] + ) + """Returns all connection strings that can be used to connect to the Autonomous Database.""" + dedicated: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The database service provides the least level of resources to each SQL statement, but supports + the most number of concurrent SQL statements.""" + high: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + low: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Low database service provides the least level of resources to each SQL statement, but + supports the most number of concurrent SQL statements.""" + medium: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + profiles: Optional[List["_models.ProfileType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of connection string profiles to allow clients to group, filter and select connection + string values based on structured metadata.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionUrlType(_model_base.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 + """ + + apex_url: Optional[str] = rest_field(name="apexUrl", visibility=["read", "create", "update", "delete", "query"]) + """Oracle Application Express (APEX) URL.""" + database_transforms_url: Optional[str] = rest_field( + name="databaseTransformsUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The URL of the Database Transforms for the Autonomous Database.""" + graph_studio_url: Optional[str] = rest_field( + name="graphStudioUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The URL of the Graph Studio for the Autonomous Database.""" + machine_learning_notebook_url: Optional[str] = rest_field( + name="machineLearningNotebookUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The URL of the Oracle Machine Learning (OML) Notebook for the Autonomous Database.""" + mongo_db_url: Optional[str] = rest_field( + name="mongoDbUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The URL of the MongoDB API for the Autonomous Database.""" + ords_url: Optional[str] = rest_field(name="ordsUrl", visibility=["read", "create", "update", "delete", "query"]) + """The Oracle REST Data Services (ORDS) URL of the Web Access for the Autonomous Database.""" + sql_dev_web_url: Optional[str] = rest_field( + name="sqlDevWebUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """Oracle SQL Developer Web URL.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CustomerContact(_model_base.Model): + """CustomerContact resource properties. + + :ivar email: The email address used by Oracle to send notifications regarding databases and + infrastructure. Required. + :vartype email: str + """ + + email: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The email address used by Oracle to send notifications regarding databases and infrastructure. + Required.""" + + @overload + def __init__( + self, + *, + email: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataCollectionOptions(_model_base.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 + """ + + is_diagnostics_events_enabled: Optional[bool] = rest_field( + name="isDiagnosticsEventsEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM + DBCS.""" + is_health_monitoring_enabled: Optional[bool] = rest_field( + name="isHealthMonitoringEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM + DBCS.""" + is_incident_logs_enabled: Optional[bool] = rest_field( + name="isIncidentLogsEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM + cluster / VMBM DBCS.""" + + @overload + def __init__( + self, + *, + is_diagnostics_events_enabled: Optional[bool] = None, + is_health_monitoring_enabled: Optional[bool] = None, + is_incident_logs_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DayOfWeek(_model_base.Model): + """DayOfWeek resource properties. + + :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 + """ + + name: Union[str, "_models.DayOfWeekName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the day of the week. Required. Known values are: \"Monday\", \"Tuesday\", + \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", and \"Sunday\".""" + + @overload + def __init__( + self, + *, + name: Union[str, "_models.DayOfWeekName"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DbActionResponse(_model_base.Model): + """ExascaleDbNode action response. + + :ivar provisioning_state: ExascaleDbNode provisioning state. Known values are: "Succeeded", + "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.AzureResourceProvisioningState + """ + + provisioning_state: Optional[Union[str, "_models.AzureResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """ExascaleDbNode provisioning state. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", + and \"Provisioning\".""" + + @overload + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "_models.AzureResourceProvisioningState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DbIormConfig(_model_base.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 + """ + + db_name: Optional[str] = rest_field(name="dbName", visibility=["read", "create", "update", "delete", "query"]) + """The database name. For the default DbPlan, the dbName is default.""" + flash_cache_limit: Optional[str] = rest_field( + name="flashCacheLimit", visibility=["read", "create", "update", "delete", "query"] + ) + """The flash cache limit for this database. This value is internally configured based on the share + value assigned to the database.""" + share: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The relative priority of this database.""" + + @overload + def __init__( + self, + *, + db_name: Optional[str] = None, + flash_cache_limit: Optional[str] = None, + share: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DbNode(ProxyResource): + """The DbNode resource belonging to vmCluster. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.DbNodeProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DbNodeProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DbNodeAction(_model_base.Model): + """DbNode action object. + + :ivar action: Db action. Required. Known values are: "Start", "Stop", "SoftReset", and "Reset". + :vartype action: str or ~azure.mgmt.oracledatabase.models.DbNodeActionEnum + """ + + action: Union[str, "_models.DbNodeActionEnum"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Db action. Required. Known values are: \"Start\", \"Stop\", \"SoftReset\", and \"Reset\".""" + + @overload + def __init__( + self, + *, + action: Union[str, "_models.DbNodeActionEnum"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DbNodeDetails(_model_base.Model): + """Details of the ExaCS Db node. Applies to Exadata Database Service on Exascale Infrastructure + only. + + :ivar db_node_id: Exascale DbNode Azure Resource ID. Required. + :vartype db_node_id: str + """ + + db_node_id: str = rest_field(name="dbNodeId", visibility=["read", "create", "update", "delete", "query"]) + """Exascale DbNode Azure Resource ID. Required.""" + + @overload + def __init__( + self, + *, + db_node_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DbNodeProperties(_model_base.Model): + """The properties of DbNodeResource. + + :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. Required. 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. Required. + :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. Required. + :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 + """ + + ocid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """DbNode OCID. Required.""" + additional_details: Optional[str] = rest_field( + name="additionalDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional information about the planned maintenance.""" + backup_ip_id: Optional[str] = rest_field( + name="backupIpId", visibility=["read", "create", "update", "delete", "query"] + ) + """The OCID of the backup IP address associated with the database node.""" + backup_vnic2_id: Optional[str] = rest_field( + name="backupVnic2Id", visibility=["read", "create", "update", "delete", "query"] + ) + """The OCID of the second backup VNIC.""" + backup_vnic_id: Optional[str] = rest_field( + name="backupVnicId", visibility=["read", "create", "update", "delete", "query"] + ) + """The OCID of the backup VNIC.""" + cpu_core_count: Optional[int] = rest_field( + name="cpuCoreCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of CPU cores enabled on the Db node.""" + db_node_storage_size_in_gbs: Optional[int] = rest_field( + name="dbNodeStorageSizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The allocated local node storage in GBs on the Db node.""" + db_server_id: Optional[str] = rest_field( + name="dbServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The OCID of the Exacc Db server associated with the database node.""" + db_system_id: str = rest_field(name="dbSystemId", visibility=["read", "create", "update", "delete", "query"]) + """The OCID of the DB system. Required.""" + fault_domain: Optional[str] = rest_field( + name="faultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the Fault Domain the instance is contained in.""" + host_ip_id: Optional[str] = rest_field(name="hostIpId", visibility=["read", "create", "update", "delete", "query"]) + """The OCID of the host IP address associated with the database node.""" + hostname: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The host name for the database node.""" + lifecycle_state: Union[str, "_models.DbNodeProvisioningState"] = rest_field( + name="lifecycleState", visibility=["read", "create", "update", "delete", "query"] + ) + """The current state of the database node. Required. Known values are: \"Provisioning\", + \"Available\", \"Updating\", \"Stopping\", \"Stopped\", \"Starting\", \"Terminating\", + \"Terminated\", and \"Failed\".""" + lifecycle_details: Optional[str] = rest_field( + name="lifecycleDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Lifecycle details of Db Node.""" + maintenance_type: Optional[Union[str, "_models.DbNodeMaintenanceType"]] = rest_field( + name="maintenanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of database node maintenance. \"VmdbRebootMigration\"""" + memory_size_in_gbs: Optional[int] = rest_field( + name="memorySizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The allocated memory in GBs on the Db node.""" + software_storage_size_in_gb: Optional[int] = rest_field( + name="softwareStorageSizeInGb", visibility=["read", "create", "update", "delete", "query"] + ) + """The size (in GB) of the block storage volume allocation for the DB system. This attribute + applies only for virtual machine DB systems.""" + time_created: datetime.datetime = rest_field( + name="timeCreated", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date and time that the database node was created. Required.""" + time_maintenance_window_end: Optional[datetime.datetime] = rest_field( + name="timeMaintenanceWindowEnd", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """End date and time of maintenance window.""" + time_maintenance_window_start: Optional[datetime.datetime] = rest_field( + name="timeMaintenanceWindowStart", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Start date and time of maintenance window.""" + vnic2_id: Optional[str] = rest_field(name="vnic2Id", visibility=["read", "create", "update", "delete", "query"]) + """The OCID of the second VNIC.""" + vnic_id: str = rest_field(name="vnicId", visibility=["read", "create", "update", "delete", "query"]) + """The OCID of the VNIC. Required.""" + provisioning_state: Optional[Union[str, "_models.ResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Azure resource provisioning state. Known values are: \"Succeeded\", \"Failed\", and + \"Canceled\".""" + + @overload + def __init__( + self, + *, + ocid: str, + db_system_id: str, + lifecycle_state: Union[str, "_models.DbNodeProvisioningState"], + time_created: datetime.datetime, + vnic_id: str, + additional_details: Optional[str] = None, + backup_ip_id: Optional[str] = None, + backup_vnic2_id: Optional[str] = None, + backup_vnic_id: Optional[str] = None, + cpu_core_count: Optional[int] = None, + db_node_storage_size_in_gbs: Optional[int] = None, + db_server_id: Optional[str] = None, + fault_domain: Optional[str] = None, + host_ip_id: Optional[str] = None, + hostname: Optional[str] = None, + lifecycle_details: Optional[str] = None, + maintenance_type: Optional[Union[str, "_models.DbNodeMaintenanceType"]] = None, + memory_size_in_gbs: Optional[int] = None, + software_storage_size_in_gb: Optional[int] = None, + time_maintenance_window_end: Optional[datetime.datetime] = None, + time_maintenance_window_start: Optional[datetime.datetime] = None, + vnic2_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DbServer(ProxyResource): + """DbServer resource model. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.DbServerProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DbServerProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DbServerPatchingDetails(_model_base.Model): + """DbServer Patching Properties. + + :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 + """ + + estimated_patch_duration: Optional[int] = rest_field(name="estimatedPatchDuration", visibility=["read"]) + """Estimated Patch Duration.""" + patching_status: Optional[Union[str, "_models.DbServerPatchingStatus"]] = rest_field( + name="patchingStatus", visibility=["read"] + ) + """Patching Status. Known values are: \"Scheduled\", \"MaintenanceInProgress\", \"Failed\", and + \"Complete\".""" + time_patching_ended: Optional[datetime.datetime] = rest_field( + name="timePatchingEnded", visibility=["read"], format="rfc3339" + ) + """Time Patching Ended.""" + time_patching_started: Optional[datetime.datetime] = rest_field( + name="timePatchingStarted", visibility=["read"], format="rfc3339" + ) + """Time Patching Started.""" + + +class DbServerProperties(_model_base.Model): + """DbServer resource properties. + + :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 + :ivar compute_model: The compute model of the Exadata Infrastructure. Known values are: "ECPU" + and "OCPU". + :vartype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + """ + + ocid: Optional[str] = rest_field(visibility=["read"]) + """Db server name.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """The name for the Db Server.""" + compartment_id: Optional[str] = rest_field(name="compartmentId", visibility=["read"]) + """The OCID of the compartment.""" + exadata_infrastructure_id: Optional[str] = rest_field(name="exadataInfrastructureId", visibility=["read"]) + """The OCID of the Exadata infrastructure.""" + cpu_core_count: Optional[int] = rest_field(name="cpuCoreCount", visibility=["read"]) + """The number of CPU cores enabled on the Db server.""" + db_server_patching_details: Optional["_models.DbServerPatchingDetails"] = rest_field( + name="dbServerPatchingDetails", visibility=["read"] + ) + """dbServerPatching details of the Db server.""" + max_memory_in_gbs: Optional[int] = rest_field(name="maxMemoryInGbs", visibility=["read"]) + """The total memory available in GBs.""" + db_node_storage_size_in_gbs: Optional[int] = rest_field(name="dbNodeStorageSizeInGbs", visibility=["read"]) + """The allocated local node storage in GBs on the Db server.""" + vm_cluster_ids: Optional[List[str]] = rest_field(name="vmClusterIds", visibility=["read"]) + """The OCID of the VM Clusters associated with the Db server.""" + db_node_ids: Optional[List[str]] = rest_field(name="dbNodeIds", visibility=["read"]) + """The OCID of the Db nodes associated with the Db server.""" + lifecycle_details: Optional[str] = rest_field(name="lifecycleDetails", visibility=["read"]) + """Lifecycle details of dbServer.""" + lifecycle_state: Optional[Union[str, "_models.DbServerProvisioningState"]] = rest_field( + name="lifecycleState", visibility=["read"] + ) + """DbServer provisioning state. Known values are: \"Creating\", \"Available\", \"Unavailable\", + \"Deleting\", \"Deleted\", and \"MaintenanceInProgress\".""" + max_cpu_count: Optional[int] = rest_field(name="maxCpuCount", visibility=["read"]) + """The total number of CPU cores available.""" + autonomous_vm_cluster_ids: Optional[List[str]] = rest_field(name="autonomousVmClusterIds", visibility=["read"]) + """The list of OCIDs of the Autonomous VM Clusters associated with the Db server.""" + autonomous_virtual_machine_ids: Optional[List[str]] = rest_field( + name="autonomousVirtualMachineIds", visibility=["read"] + ) + """The list of OCIDs of the Autonomous Virtual Machines associated with the Db server.""" + max_db_node_storage_in_gbs: Optional[int] = rest_field(name="maxDbNodeStorageInGbs", visibility=["read"]) + """The total max dbNode storage in GBs.""" + memory_size_in_gbs: Optional[int] = rest_field(name="memorySizeInGbs", visibility=["read"]) + """The total memory size in GBs.""" + shape: Optional[str] = rest_field(visibility=["read"]) + """The shape of the Db server. The shape determines the amount of CPU, storage, and memory + resources available.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """The date and time that the Db Server was created.""" + provisioning_state: Optional[Union[str, "_models.ResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Azure resource provisioning state. Known values are: \"Succeeded\", \"Failed\", and + \"Canceled\".""" + compute_model: Optional[Union[str, "_models.ComputeModel"]] = rest_field(name="computeModel", visibility=["read"]) + """The compute model of the Exadata Infrastructure. Known values are: \"ECPU\" and \"OCPU\".""" + + +class DbSystemShape(ProxyResource): + """DbSystemShape resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.DbSystemShapeProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DbSystemShapeProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DbSystemShapeProperties(_model_base.Model): + """DbSystemShape resource model. + + :ivar shape_family: The family of the shape used for the DB system. + :vartype shape_family: str + :ivar shape_name: The shape used for the DB system. Required. + :vartype shape_name: 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 + :ivar compute_model: The compute model of the Exadata Infrastructure. Known values are: "ECPU" + and "OCPU". + :vartype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + :ivar are_server_types_supported: Indicates if the shape supports database and storage server + types. + :vartype are_server_types_supported: bool + :ivar display_name: The display name of the shape used for the DB system. + :vartype display_name: str + """ + + shape_family: Optional[str] = rest_field( + name="shapeFamily", visibility=["read", "create", "update", "delete", "query"] + ) + """The family of the shape used for the DB system.""" + shape_name: str = rest_field(name="shapeName", visibility=["read", "create", "update", "delete", "query"]) + """The shape used for the DB system. Required.""" + available_core_count: int = rest_field( + name="availableCoreCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of CPU cores that can be enabled on the DB system for this shape. Required.""" + minimum_core_count: Optional[int] = rest_field( + name="minimumCoreCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The minimum number of CPU cores that can be enabled on the DB system for this shape.""" + runtime_minimum_core_count: Optional[int] = rest_field( + name="runtimeMinimumCoreCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The runtime minimum number of CPU cores that can be enabled on the DB system for this shape.""" + core_count_increment: Optional[int] = rest_field( + name="coreCountIncrement", visibility=["read", "create", "update", "delete", "query"] + ) + """The discrete number by which the CPU core count for this shape can be increased or decreased.""" + min_storage_count: Optional[int] = rest_field( + name="minStorageCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The minimum number of Exadata storage servers available for the Exadata infrastructure.""" + max_storage_count: Optional[int] = rest_field( + name="maxStorageCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of Exadata storage servers available for the Exadata infrastructure.""" + available_data_storage_per_server_in_tbs: Optional[float] = rest_field( + name="availableDataStoragePerServerInTbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum data storage available per storage server for this shape. Only applicable to ExaCC + Elastic shapes.""" + available_memory_per_node_in_gbs: Optional[int] = rest_field( + name="availableMemoryPerNodeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum memory available per database node for this shape. Only applicable to ExaCC Elastic + shapes.""" + available_db_node_per_node_in_gbs: Optional[int] = rest_field( + name="availableDbNodePerNodeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum Db Node storage available per database node for this shape. Only applicable to + ExaCC Elastic shapes.""" + min_core_count_per_node: Optional[int] = rest_field( + name="minCoreCountPerNode", visibility=["read", "create", "update", "delete", "query"] + ) + """The minimum number of CPU cores that can be enabled per node for this shape.""" + available_memory_in_gbs: Optional[int] = rest_field( + name="availableMemoryInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum memory that can be enabled for this shape.""" + min_memory_per_node_in_gbs: Optional[int] = rest_field( + name="minMemoryPerNodeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The minimum memory that need be allocated per node for this shape.""" + available_db_node_storage_in_gbs: Optional[int] = rest_field( + name="availableDbNodeStorageInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum Db Node storage that can be enabled for this shape.""" + min_db_node_storage_per_node_in_gbs: Optional[int] = rest_field( + name="minDbNodeStoragePerNodeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The minimum Db Node storage that need be allocated per node for this shape.""" + available_data_storage_in_tbs: Optional[int] = rest_field( + name="availableDataStorageInTbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum DATA storage that can be enabled for this shape.""" + min_data_storage_in_tbs: Optional[int] = rest_field( + name="minDataStorageInTbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The minimum data storage that need be allocated for this shape.""" + minimum_node_count: Optional[int] = rest_field( + name="minimumNodeCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The minimum number of database nodes available for this shape.""" + maximum_node_count: Optional[int] = rest_field( + name="maximumNodeCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of database nodes available for this shape.""" + available_core_count_per_node: Optional[int] = rest_field( + name="availableCoreCountPerNode", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + compute_model: Optional[Union[str, "_models.ComputeModel"]] = rest_field( + name="computeModel", visibility=["read", "create", "update", "delete", "query"] + ) + """The compute model of the Exadata Infrastructure. Known values are: \"ECPU\" and \"OCPU\".""" + are_server_types_supported: Optional[bool] = rest_field( + name="areServerTypesSupported", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates if the shape supports database and storage server types.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """The display name of the shape used for the DB system.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + shape_name: str, + available_core_count: int, + shape_family: Optional[str] = None, + minimum_core_count: Optional[int] = None, + runtime_minimum_core_count: Optional[int] = None, + core_count_increment: Optional[int] = None, + min_storage_count: Optional[int] = None, + max_storage_count: Optional[int] = None, + available_data_storage_per_server_in_tbs: Optional[float] = None, + available_memory_per_node_in_gbs: Optional[int] = None, + available_db_node_per_node_in_gbs: Optional[int] = None, + min_core_count_per_node: Optional[int] = None, + available_memory_in_gbs: Optional[int] = None, + min_memory_per_node_in_gbs: Optional[int] = None, + available_db_node_storage_in_gbs: Optional[int] = None, + min_db_node_storage_per_node_in_gbs: Optional[int] = None, + available_data_storage_in_tbs: Optional[int] = None, + min_data_storage_in_tbs: Optional[int] = None, + minimum_node_count: Optional[int] = None, + maximum_node_count: Optional[int] = None, + available_core_count_per_node: Optional[int] = None, + compute_model: Optional[Union[str, "_models.ComputeModel"]] = None, + are_server_types_supported: Optional[bool] = None, + display_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DefinedFileSystemConfiguration(_model_base.Model): + """Predefined configurations for the file system. + + :ivar is_backup_partition: Checks if the data can be backed up. + :vartype is_backup_partition: bool + :ivar is_resizable: Checks if the mount path is resizable. + :vartype is_resizable: bool + :ivar min_size_gb: Minimum size of mount path in Gb. + :vartype min_size_gb: int + :ivar mount_point: Mount path for the file system. + :vartype mount_point: str + """ + + is_backup_partition: Optional[bool] = rest_field( + name="isBackupPartition", visibility=["read", "create", "update", "delete", "query"] + ) + """Checks if the data can be backed up.""" + is_resizable: Optional[bool] = rest_field( + name="isResizable", visibility=["read", "create", "update", "delete", "query"] + ) + """Checks if the mount path is resizable.""" + min_size_gb: Optional[int] = rest_field( + name="minSizeGb", visibility=["read", "create", "update", "delete", "query"] + ) + """Minimum size of mount path in Gb.""" + mount_point: Optional[str] = rest_field( + name="mountPoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Mount path for the file system.""" + + @overload + def __init__( + self, + *, + is_backup_partition: Optional[bool] = None, + is_resizable: Optional[bool] = None, + min_size_gb: Optional[int] = None, + mount_point: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DisasterRecoveryConfigurationDetails(_model_base.Model): + """Configurations of a Disaster Recovery Details. + + :ivar disaster_recovery_type: Indicates the disaster recovery (DR) type of the Autonomous + Database Serverless instance. Autonomous Data Guard (ADG) DR type provides business critical DR + with a faster recovery time objective (RTO) during failover or switchover. Backup-based DR type + provides lower cost DR with a slower RTO during failover or switchover. Known values are: "Adg" + and "BackupBased". + :vartype disaster_recovery_type: str or ~azure.mgmt.oracledatabase.models.DisasterRecoveryType + :ivar time_snapshot_standby_enabled_till: Time and date stored as an RFC 3339 formatted + timestamp string. For example, 2022-01-01T12:00:00.000Z would set a limit for the snapshot + standby to be converted back to a cross-region standby database. + :vartype time_snapshot_standby_enabled_till: ~datetime.datetime + :ivar is_snapshot_standby: Indicates if user wants to convert to a snapshot standby. For + example, true would set a standby database to snapshot standby database. False would set a + snapshot standby database back to regular standby database. + :vartype is_snapshot_standby: bool + :ivar is_replicate_automatic_backups: If true, 7 days worth of backups are replicated across + regions for Cross-Region ADB or Backup-Based DR between Primary and Standby. If false, the + backups taken on the Primary are not replicated to the Standby database. + :vartype is_replicate_automatic_backups: bool + """ + + disaster_recovery_type: Optional[Union[str, "_models.DisasterRecoveryType"]] = rest_field( + name="disasterRecoveryType", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the disaster recovery (DR) type of the Autonomous Database Serverless instance. + Autonomous Data Guard (ADG) DR type provides business critical DR with a faster recovery time + objective (RTO) during failover or switchover. Backup-based DR type provides lower cost DR with + a slower RTO during failover or switchover. Known values are: \"Adg\" and \"BackupBased\".""" + time_snapshot_standby_enabled_till: Optional[datetime.datetime] = rest_field( + name="timeSnapshotStandbyEnabledTill", + visibility=["read", "create", "update", "delete", "query"], + format="rfc3339", + ) + """Time and date stored as an RFC 3339 formatted timestamp string. For example, + 2022-01-01T12:00:00.000Z would set a limit for the snapshot standby to be converted back to a + cross-region standby database.""" + is_snapshot_standby: Optional[bool] = rest_field( + name="isSnapshotStandby", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates if user wants to convert to a snapshot standby. For example, true would set a standby + database to snapshot standby database. False would set a snapshot standby database back to + regular standby database.""" + is_replicate_automatic_backups: Optional[bool] = rest_field( + name="isReplicateAutomaticBackups", visibility=["read", "create", "update", "delete", "query"] + ) + """If true, 7 days worth of backups are replicated across regions for Cross-Region ADB or + Backup-Based DR between Primary and Standby. If false, the backups taken on the Primary are not + replicated to the Standby database.""" + + @overload + def __init__( + self, + *, + disaster_recovery_type: Optional[Union[str, "_models.DisasterRecoveryType"]] = None, + time_snapshot_standby_enabled_till: Optional[datetime.datetime] = None, + is_snapshot_standby: Optional[bool] = None, + is_replicate_automatic_backups: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DnsPrivateView(ProxyResource): + """DnsPrivateView resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.DnsPrivateViewProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DnsPrivateViewProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DnsPrivateViewProperties(_model_base.Model): + """Views resource model. + + :ivar ocid: The OCID of the view. Required. + :vartype ocid: str + :ivar display_name: The display name of the view resource. Required. + :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. Required. 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 + """ + + ocid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The OCID of the view. Required.""" + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """The display name of the view resource. Required.""" + is_protected: bool = rest_field(name="isProtected", visibility=["read", "create", "update", "delete", "query"]) + """A Boolean flag indicating whether or not parts of the resource are unable to be explicitly + managed. Required.""" + lifecycle_state: Union[str, "_models.DnsPrivateViewsLifecycleState"] = rest_field( + name="lifecycleState", visibility=["read", "create", "update", "delete", "query"] + ) + """Views lifecycleState. Required. Known values are: \"Active\", \"Deleted\", \"Deleting\", and + \"Updating\".""" + self_property: str = rest_field(name="self", visibility=["read", "create", "update", "delete", "query"]) + """The canonical absolute URL of the resource. Required.""" + time_created: datetime.datetime = rest_field( + name="timeCreated", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """views timeCreated. Required.""" + time_updated: datetime.datetime = rest_field( + name="timeUpdated", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """views timeCreated. Required.""" + provisioning_state: Optional[Union[str, "_models.ResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Azure resource provisioning state. Known values are: \"Succeeded\", \"Failed\", and + \"Canceled\".""" + + @overload + def __init__( + self, + *, + ocid: str, + display_name: str, + is_protected: bool, + lifecycle_state: Union[str, "_models.DnsPrivateViewsLifecycleState"], + self_property: str, + time_created: datetime.datetime, + time_updated: datetime.datetime, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DnsPrivateZone(ProxyResource): + """DnsPrivateZone resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.DnsPrivateZoneProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DnsPrivateZoneProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DnsPrivateZoneProperties(_model_base.Model): + """Zones resource model. + + :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. Required. 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 + """ + + ocid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The OCID of the Zone. Required.""" + is_protected: bool = rest_field(name="isProtected", visibility=["read", "create", "update", "delete", "query"]) + """A Boolean flag indicating whether or not parts of the resource are unable to be explicitly + managed. Required.""" + lifecycle_state: Union[str, "_models.DnsPrivateZonesLifecycleState"] = rest_field( + name="lifecycleState", visibility=["read", "create", "update", "delete", "query"] + ) + """Zones lifecycleState. Required. Known values are: \"Active\", \"Creating\", \"Deleted\", + \"Deleting\", and \"Updating\".""" + self_property: str = rest_field(name="self", visibility=["read", "create", "update", "delete", "query"]) + """The canonical absolute URL of the resource. Required.""" + serial: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The current serial of the zone. As seen in the zone's SOA record. Required.""" + version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + view_id: Optional[str] = rest_field(name="viewId", visibility=["read", "create", "update", "delete", "query"]) + """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.""" + zone_type: Union[str, "_models.ZoneType"] = rest_field( + name="zoneType", visibility=["read", "create", "update", "delete", "query"] + ) + """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\".""" + time_created: datetime.datetime = rest_field( + name="timeCreated", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Zones timeCreated. Required.""" + provisioning_state: Optional[Union[str, "_models.ResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Azure resource provisioning state. Known values are: \"Succeeded\", \"Failed\", and + \"Canceled\".""" + + @overload + def __init__( + self, + *, + ocid: str, + is_protected: bool, + lifecycle_state: Union[str, "_models.DnsPrivateZonesLifecycleState"], + self_property: str, + serial: int, + version: str, + zone_type: Union[str, "_models.ZoneType"], + time_created: datetime.datetime, + view_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_model_base.Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_model_base.Model): + """The error detail. + + :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] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[List["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_model_base.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.oracledatabase.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EstimatedPatchingTime(_model_base.Model): + """The estimated total time required in minutes for all patching operations (database server, + storage server, and network switch patching). + + :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 + """ + + estimated_db_server_patching_time: Optional[int] = rest_field( + name="estimatedDbServerPatchingTime", visibility=["read"] + ) + """The estimated time required in minutes for database server patching.""" + estimated_network_switches_patching_time: Optional[int] = rest_field( + name="estimatedNetworkSwitchesPatchingTime", visibility=["read"] + ) + """The estimated time required in minutes for network switch patching.""" + estimated_storage_server_patching_time: Optional[int] = rest_field( + name="estimatedStorageServerPatchingTime", visibility=["read"] + ) + """The estimated time required in minutes for storage server patching.""" + total_estimated_patching_time: Optional[int] = rest_field(name="totalEstimatedPatchingTime", visibility=["read"]) + """The estimated total time required in minutes for all patching operations.""" + + +class ExadataIormConfig(_model_base.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 + """ + + db_plans: Optional[List["_models.DbIormConfig"]] = rest_field( + name="dbPlans", visibility=["read", "create", "update", "delete", "query"] + ) + """An array of IORM settings for all the database in the Exadata DB system.""" + lifecycle_details: Optional[str] = rest_field( + name="lifecycleDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional information about the current lifecycleState.""" + lifecycle_state: Optional[Union[str, "_models.IormLifecycleState"]] = rest_field( + name="lifecycleState", visibility=["read", "create", "update", "delete", "query"] + ) + """The current state of IORM configuration for the Exadata DB system. Known values are: + \"BootStrapping\", \"Enabled\", \"Disabled\", \"Updating\", and \"Failed\".""" + objective: Optional[Union[str, "_models.Objective"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The current value for the IORM objective. The default is AUTO. Known values are: + \"LowLatency\", \"HighThroughput\", \"Balanced\", \"Auto\", and \"Basic\".""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExadbVmCluster(TrackedResource): + """ExadbVmCluster resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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.ExadbVmClusterProperties + :ivar zones: The availability zones. + :vartype zones: list[str] + """ + + properties: Optional["_models.ExadbVmClusterProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + zones: Optional[List[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The availability zones.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ExadbVmClusterProperties"] = None, + zones: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExadbVmClusterProperties(_model_base.Model): + """ExadbVmCluster resource model. + + :ivar ocid: ExadbVmCluster ocid. + :vartype ocid: str + :ivar cluster_name: The cluster name for Exadata VM cluster on Exascale Infrastructure. The + cluster name must begin with an alphabetic character, and may contain hyphens (-). Underscores + (_) are not permitted. The cluster name can be no longer than 11 characters and is not case + sensitive. + :vartype cluster_name: str + :ivar backup_subnet_cidr: Client OCI backup subnet CIDR, default is 192.168.252.0/22. + :vartype backup_subnet_cidr: str + :ivar nsg_url: HTTPS link to OCI Network Security Group exposed to Azure Customer via the Azure + Interface. + :vartype nsg_url: str + :ivar provisioning_state: Exadata VM cluster on Exascale Infrastructure 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.ExadbVmClusterLifecycleState + :ivar vnet_id: VNET for network connectivity. Required. + :vartype vnet_id: str + :ivar subnet_id: Client subnet. Required. + :vartype subnet_id: str + :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 domain: A domain name used for the Exadata VM cluster on Exascale Infrastructure. + :vartype domain: str + :ivar enabled_ecpu_count: The number of ECPUs to enable for an Exadata VM cluster on Exascale + Infrastructure. Required. + :vartype enabled_ecpu_count: int + :ivar exascale_db_storage_vault_id: The Azure Resource ID of the Exadata Database Storage + Vault. Required. + :vartype exascale_db_storage_vault_id: str + :ivar grid_image_ocid: Grid Setup will be done using this Grid Image OCID. Can be obtained + using giMinorVersions API. + :vartype grid_image_ocid: str + :ivar grid_image_type: The type of Grid Image. Known values are: "ReleaseUpdate" and + "CustomImage". + :vartype grid_image_type: str or ~azure.mgmt.oracledatabase.models.GridImageType + :ivar gi_version: Oracle Grid Infrastructure (GI) software version. + :vartype gi_version: str + :ivar hostname: The hostname for the Exadata VM cluster on Exascale Infrastructure. Required. + :vartype hostname: str + :ivar license_model: The Oracle license model that applies to the Exadata VM cluster on + Exascale Infrastructure. The default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" + and "BringYourOwnLicense". + :vartype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :ivar memory_size_in_gbs: The memory that you want to be allocated in GBs. Memory is calculated + based on 11 GB per VM core reserved. + :vartype memory_size_in_gbs: int + :ivar node_count: The number of nodes in the Exadata VM cluster on Exascale Infrastructure. + Required. + :vartype node_count: int + :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 zone_ocid: The OCID of the zone the Exadata VM cluster on Exascale Infrastructure is + associated with. + :vartype zone_ocid: str + :ivar private_zone_ocid: The OCID of the zone the Exadata VM cluster on Exascale Infrastructure + is associated with. + :vartype private_zone_ocid: 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 listener_port: The port number configured for the listener on the Exadata VM cluster on + Exascale Infrastructure. + :vartype listener_port: int + :ivar shape: The shape of the Exadata VM cluster on Exascale Infrastructure resource. Required. + :vartype shape: str + :ivar ssh_public_keys: The public key portion of one or more key pairs used for SSH access to + the Exadata VM cluster on Exascale Infrastructure. Required. + :vartype ssh_public_keys: list[str] + :ivar system_version: Operating system version of the image. + :vartype system_version: str + :ivar time_zone: The time zone of the Exadata VM cluster on Exascale Infrastructure. For + details, see `Exadata Infrastructure Time Zones `_. + :vartype time_zone: str + :ivar total_ecpu_count: The number of Total ECPUs for an Exadata VM cluster on Exascale + Infrastructure. Required. + :vartype total_ecpu_count: int + :ivar vm_file_system_storage: Filesystem storage details. Required. + :vartype vm_file_system_storage: ~azure.mgmt.oracledatabase.models.ExadbVmClusterStorageDetails + :ivar lifecycle_details: Additional information about the current lifecycle state. + :vartype lifecycle_details: str + :ivar scan_dns_name: The FQDN of the DNS record for the SCAN IP addresses that are associated + with the Exadata VM cluster on Exascale Infrastructure. + :vartype scan_dns_name: str + :ivar scan_ip_ids: The Single Client Access Name (SCAN) IP addresses associated with the + Exadata VM cluster on Exascale Infrastructure. SCAN IP addresses are typically used for load + balancing and are not assigned to any interface. Oracle Clusterware directs the requests to the + appropriate nodes in the cluster. **Note:** For a single-node DB system, this list is empty. + :vartype scan_ip_ids: list[str] + :ivar scan_dns_record_id: The OCID of the DNS record for the SCAN IP addresses that are + associated with the Exadata VM cluster on Exascale Infrastructure. + :vartype scan_dns_record_id: str + :ivar snapshot_file_system_storage: Snapshot filesystem storage details. + :vartype snapshot_file_system_storage: + ~azure.mgmt.oracledatabase.models.ExadbVmClusterStorageDetails + :ivar total_file_system_storage: Total file system storage details. + :vartype total_file_system_storage: + ~azure.mgmt.oracledatabase.models.ExadbVmClusterStorageDetails + :ivar vip_ids: The virtual IP (VIP) addresses associated with the Exadata VM cluster on + Exascale Infrastructure. The Cluster Ready Services (CRS) creates and maintains one VIP address + for each node in the Exadata Cloud Service instance to enable failover. If one node fails, the + VIP is reassigned to another active node in the cluster. **Note:** For a single-node DB system, + this list is empty. + :vartype vip_ids: list[str] + :ivar oci_url: HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + :vartype oci_url: str + :ivar iorm_config_cache: iormConfigCache details for Exadata VM cluster on Exascale + Infrastructure. + :vartype iorm_config_cache: ~azure.mgmt.oracledatabase.models.ExadataIormConfig + :ivar backup_subnet_ocid: Cluster backup subnet ocid. + :vartype backup_subnet_ocid: str + :ivar subnet_ocid: Cluster subnet ocid. + :vartype subnet_ocid: str + """ + + ocid: Optional[str] = rest_field(visibility=["read"]) + """ExadbVmCluster ocid.""" + cluster_name: Optional[str] = rest_field(name="clusterName", visibility=["read", "create"]) + """The cluster name for Exadata VM cluster on Exascale Infrastructure. The cluster name must begin + with an alphabetic character, and may contain hyphens (-). Underscores (_) are not permitted. + The cluster name can be no longer than 11 characters and is not case sensitive.""" + backup_subnet_cidr: Optional[str] = rest_field(name="backupSubnetCidr", visibility=["read", "create"]) + """Client OCI backup subnet CIDR, default is 192.168.252.0/22.""" + nsg_url: Optional[str] = rest_field(name="nsgUrl", visibility=["read"]) + """HTTPS link to OCI Network Security Group exposed to Azure Customer via the Azure Interface.""" + provisioning_state: Optional[Union[str, "_models.AzureResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Exadata VM cluster on Exascale Infrastructure provisioning state. Known values are: + \"Succeeded\", \"Failed\", \"Canceled\", and \"Provisioning\".""" + lifecycle_state: Optional[Union[str, "_models.ExadbVmClusterLifecycleState"]] = rest_field( + name="lifecycleState", visibility=["read"] + ) + """CloudVmCluster lifecycle state. Known values are: \"Provisioning\", \"Available\", + \"Updating\", \"Terminating\", \"Terminated\", \"MaintenanceInProgress\", and \"Failed\".""" + vnet_id: str = rest_field(name="vnetId", visibility=["read", "create"]) + """VNET for network connectivity. Required.""" + subnet_id: str = rest_field(name="subnetId", visibility=["read", "create"]) + """Client subnet. Required.""" + data_collection_options: Optional["_models.DataCollectionOptions"] = rest_field( + name="dataCollectionOptions", visibility=["read", "create"] + ) + """Indicates user preferences for the various diagnostic collection options for the VM + cluster/Cloud VM cluster/VMBM DBCS.""" + display_name: str = rest_field(name="displayName", visibility=["read", "create"]) + """Display Name. Required.""" + domain: Optional[str] = rest_field(visibility=["read", "create"]) + """A domain name used for the Exadata VM cluster on Exascale Infrastructure.""" + enabled_ecpu_count: int = rest_field(name="enabledEcpuCount", visibility=["read", "create"]) + """The number of ECPUs to enable for an Exadata VM cluster on Exascale Infrastructure. Required.""" + exascale_db_storage_vault_id: str = rest_field(name="exascaleDbStorageVaultId", visibility=["read", "create"]) + """The Azure Resource ID of the Exadata Database Storage Vault. Required.""" + grid_image_ocid: Optional[str] = rest_field(name="gridImageOcid", visibility=["read", "create"]) + """Grid Setup will be done using this Grid Image OCID. Can be obtained using giMinorVersions API.""" + grid_image_type: Optional[Union[str, "_models.GridImageType"]] = rest_field( + name="gridImageType", visibility=["read"] + ) + """The type of Grid Image. Known values are: \"ReleaseUpdate\" and \"CustomImage\".""" + gi_version: Optional[str] = rest_field(name="giVersion", visibility=["read"]) + """Oracle Grid Infrastructure (GI) software version.""" + hostname: str = rest_field(visibility=["read", "create"]) + """The hostname for the Exadata VM cluster on Exascale Infrastructure. Required.""" + license_model: Optional[Union[str, "_models.LicenseModel"]] = rest_field( + name="licenseModel", visibility=["read", "create"] + ) + """The Oracle license model that applies to the Exadata VM cluster on Exascale Infrastructure. The + default is LICENSE_INCLUDED. Known values are: \"LicenseIncluded\" and \"BringYourOwnLicense\".""" + memory_size_in_gbs: Optional[int] = rest_field(name="memorySizeInGbs", visibility=["read"]) + """The memory that you want to be allocated in GBs. Memory is calculated based on 11 GB per VM + core reserved.""" + node_count: int = rest_field(name="nodeCount", visibility=["read", "create", "update"]) + """The number of nodes in the Exadata VM cluster on Exascale Infrastructure. Required.""" + nsg_cidrs: Optional[List["_models.NsgCidr"]] = rest_field(name="nsgCidrs", visibility=["read", "create"]) + """CIDR blocks for additional NSG ingress rules. The VNET CIDRs used to provision the VM Cluster + will be added by default.""" + zone_ocid: Optional[str] = rest_field(name="zoneOcid", visibility=["read"]) + """The OCID of the zone the Exadata VM cluster on Exascale Infrastructure is associated with.""" + private_zone_ocid: Optional[str] = rest_field(name="privateZoneOcid", visibility=["read", "create"]) + """The OCID of the zone the Exadata VM cluster on Exascale Infrastructure is associated with.""" + scan_listener_port_tcp: Optional[int] = rest_field(name="scanListenerPortTcp", visibility=["read", "create"]) + """The TCP Single Client Access Name (SCAN) port. The default port is 1521.""" + scan_listener_port_tcp_ssl: Optional[int] = rest_field(name="scanListenerPortTcpSsl", visibility=["read", "create"]) + """The TCPS Single Client Access Name (SCAN) port. The default port is 2484.""" + listener_port: Optional[int] = rest_field(name="listenerPort", visibility=["read"]) + """The port number configured for the listener on the Exadata VM cluster on Exascale + Infrastructure.""" + shape: str = rest_field(visibility=["read", "create"]) + """The shape of the Exadata VM cluster on Exascale Infrastructure resource. Required.""" + ssh_public_keys: List[str] = rest_field(name="sshPublicKeys", visibility=["read", "create"]) + """The public key portion of one or more key pairs used for SSH access to the Exadata VM cluster + on Exascale Infrastructure. Required.""" + system_version: Optional[str] = rest_field(name="systemVersion", visibility=["read", "create"]) + """Operating system version of the image.""" + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create"]) + """The time zone of the Exadata VM cluster on Exascale Infrastructure. For details, see `Exadata + Infrastructure Time Zones `_.""" + total_ecpu_count: int = rest_field(name="totalEcpuCount", visibility=["read", "create"]) + """The number of Total ECPUs for an Exadata VM cluster on Exascale Infrastructure. Required.""" + vm_file_system_storage: "_models.ExadbVmClusterStorageDetails" = rest_field( + name="vmFileSystemStorage", visibility=["read", "create"] + ) + """Filesystem storage details. Required.""" + lifecycle_details: Optional[str] = rest_field(name="lifecycleDetails", visibility=["read"]) + """Additional information about the current lifecycle state.""" + scan_dns_name: Optional[str] = rest_field(name="scanDnsName", visibility=["read"]) + """The FQDN of the DNS record for the SCAN IP addresses that are associated with the Exadata VM + cluster on Exascale Infrastructure.""" + scan_ip_ids: Optional[List[str]] = rest_field(name="scanIpIds", visibility=["read"]) + """The Single Client Access Name (SCAN) IP addresses associated with the Exadata VM cluster on + Exascale Infrastructure. SCAN IP addresses are typically used for load balancing and are not + assigned to any interface. Oracle Clusterware directs the requests to the appropriate nodes in + the cluster. **Note:** For a single-node DB system, this list is empty.""" + scan_dns_record_id: Optional[str] = rest_field(name="scanDnsRecordId", visibility=["read"]) + """The OCID of the DNS record for the SCAN IP addresses that are associated with the Exadata VM + cluster on Exascale Infrastructure.""" + snapshot_file_system_storage: Optional["_models.ExadbVmClusterStorageDetails"] = rest_field( + name="snapshotFileSystemStorage", visibility=["read"] + ) + """Snapshot filesystem storage details.""" + total_file_system_storage: Optional["_models.ExadbVmClusterStorageDetails"] = rest_field( + name="totalFileSystemStorage", visibility=["read"] + ) + """Total file system storage details.""" + vip_ids: Optional[List[str]] = rest_field(name="vipIds", visibility=["read"]) + """The virtual IP (VIP) addresses associated with the Exadata VM cluster on Exascale + Infrastructure. The Cluster Ready Services (CRS) creates and maintains one VIP address for each + node in the Exadata Cloud Service instance to enable failover. If one node fails, the VIP is + reassigned to another active node in the cluster. **Note:** For a single-node DB system, this + list is empty.""" + oci_url: Optional[str] = rest_field(name="ociUrl", visibility=["read"]) + """HTTPS link to OCI resources exposed to Azure Customer via Azure Interface.""" + iorm_config_cache: Optional["_models.ExadataIormConfig"] = rest_field(name="iormConfigCache", visibility=["read"]) + """iormConfigCache details for Exadata VM cluster on Exascale Infrastructure.""" + backup_subnet_ocid: Optional[str] = rest_field(name="backupSubnetOcid", visibility=["read"]) + """Cluster backup subnet ocid.""" + subnet_ocid: Optional[str] = rest_field(name="subnetOcid", visibility=["read"]) + """Cluster subnet ocid.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + vnet_id: str, + subnet_id: str, + display_name: str, + enabled_ecpu_count: int, + exascale_db_storage_vault_id: str, + hostname: str, + node_count: int, + shape: str, + ssh_public_keys: List[str], + total_ecpu_count: int, + vm_file_system_storage: "_models.ExadbVmClusterStorageDetails", + cluster_name: Optional[str] = None, + backup_subnet_cidr: Optional[str] = None, + data_collection_options: Optional["_models.DataCollectionOptions"] = None, + domain: Optional[str] = None, + grid_image_ocid: Optional[str] = None, + license_model: Optional[Union[str, "_models.LicenseModel"]] = None, + nsg_cidrs: Optional[List["_models.NsgCidr"]] = None, + private_zone_ocid: Optional[str] = None, + scan_listener_port_tcp: Optional[int] = None, + scan_listener_port_tcp_ssl: Optional[int] = None, + system_version: Optional[str] = None, + time_zone: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExadbVmClusterStorageDetails(_model_base.Model): + """Storage Details on the Exadata VM cluster. + + :ivar total_size_in_gbs: Total Capacity. Required. + :vartype total_size_in_gbs: int + """ + + total_size_in_gbs: int = rest_field( + name="totalSizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """Total Capacity. Required.""" + + @overload + def __init__( + self, + *, + total_size_in_gbs: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExadbVmClusterUpdate(_model_base.Model): + """The type used for update operations of the ExadbVmCluster. + + :ivar zones: The availability zones. + :vartype zones: list[str] + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.ExadbVmClusterUpdateProperties + """ + + zones: Optional[List[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The availability zones.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.ExadbVmClusterUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + zones: Optional[List[str]] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ExadbVmClusterUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExadbVmClusterUpdateProperties(_model_base.Model): + """The updatable properties of the ExadbVmCluster. + + :ivar node_count: The number of nodes in the Exadata VM cluster on Exascale Infrastructure. + :vartype node_count: int + """ + + node_count: Optional[int] = rest_field(name="nodeCount", visibility=["read", "create", "update"]) + """The number of nodes in the Exadata VM cluster on Exascale Infrastructure.""" + + @overload + def __init__( + self, + *, + node_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExascaleDbNode(ProxyResource): + """The DbNode resource belonging to ExadbVmCluster. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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.ExascaleDbNodeProperties + """ + + properties: Optional["_models.ExascaleDbNodeProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ExascaleDbNodeProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExascaleDbNodeProperties(_model_base.Model): + """The properties of DbNodeResource. + + :ivar ocid: DbNode OCID. Required. + :vartype ocid: str + :ivar additional_details: Additional information about the planned maintenance. + :vartype additional_details: 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 fault_domain: The name of the Fault Domain the instance is contained in. + :vartype fault_domain: 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 maintenance_type: The type of database node maintenance. + :vartype maintenance_type: str + :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_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 total_cpu_core_count: The total number of CPU cores reserved on the Db node. + :vartype total_cpu_core_count: int + """ + + ocid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """DbNode OCID. Required.""" + additional_details: Optional[str] = rest_field( + name="additionalDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional information about the planned maintenance.""" + cpu_core_count: Optional[int] = rest_field( + name="cpuCoreCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of CPU cores enabled on the Db node.""" + db_node_storage_size_in_gbs: Optional[int] = rest_field( + name="dbNodeStorageSizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The allocated local node storage in GBs on the Db node.""" + fault_domain: Optional[str] = rest_field( + name="faultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the Fault Domain the instance is contained in.""" + hostname: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The host name for the database node.""" + lifecycle_state: Optional[Union[str, "_models.DbNodeProvisioningState"]] = rest_field( + name="lifecycleState", visibility=["read", "create", "update", "delete", "query"] + ) + """The current state of the database node. Known values are: \"Provisioning\", \"Available\", + \"Updating\", \"Stopping\", \"Stopped\", \"Starting\", \"Terminating\", \"Terminated\", and + \"Failed\".""" + maintenance_type: Optional[str] = rest_field( + name="maintenanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of database node maintenance.""" + memory_size_in_gbs: Optional[int] = rest_field( + name="memorySizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """The allocated memory in GBs on the Db node.""" + software_storage_size_in_gb: Optional[int] = rest_field( + name="softwareStorageSizeInGb", visibility=["read", "create", "update", "delete", "query"] + ) + """The size (in GB) of the block storage volume allocation for the DB system. This attribute + applies only for virtual machine DB systems.""" + time_maintenance_window_end: Optional[datetime.datetime] = rest_field( + name="timeMaintenanceWindowEnd", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """End date and time of maintenance window.""" + time_maintenance_window_start: Optional[datetime.datetime] = rest_field( + name="timeMaintenanceWindowStart", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Start date and time of maintenance window.""" + total_cpu_core_count: Optional[int] = rest_field( + name="totalCpuCoreCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The total number of CPU cores reserved on the Db node.""" + + @overload + def __init__( + self, + *, + ocid: str, + additional_details: Optional[str] = None, + cpu_core_count: Optional[int] = None, + db_node_storage_size_in_gbs: Optional[int] = None, + fault_domain: Optional[str] = None, + hostname: Optional[str] = None, + lifecycle_state: Optional[Union[str, "_models.DbNodeProvisioningState"]] = None, + maintenance_type: Optional[str] = None, + memory_size_in_gbs: Optional[int] = None, + software_storage_size_in_gb: Optional[int] = None, + time_maintenance_window_end: Optional[datetime.datetime] = None, + time_maintenance_window_start: Optional[datetime.datetime] = None, + total_cpu_core_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExascaleDbStorageDetails(_model_base.Model): + """Exadata Database Storage Details. + + :ivar available_size_in_gbs: Available Capacity. + :vartype available_size_in_gbs: int + :ivar total_size_in_gbs: Total Capacity. + :vartype total_size_in_gbs: int + """ + + available_size_in_gbs: Optional[int] = rest_field( + name="availableSizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """Available Capacity.""" + total_size_in_gbs: Optional[int] = rest_field( + name="totalSizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """Total Capacity.""" + + @overload + def __init__( + self, + *, + available_size_in_gbs: Optional[int] = None, + total_size_in_gbs: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExascaleDbStorageInputDetails(_model_base.Model): + """Create exadata Database Storage Details model. + + :ivar total_size_in_gbs: Total Capacity. Required. + :vartype total_size_in_gbs: int + """ + + total_size_in_gbs: int = rest_field( + name="totalSizeInGbs", visibility=["read", "create", "update", "delete", "query"] + ) + """Total Capacity. Required.""" + + @overload + def __init__( + self, + *, + total_size_in_gbs: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExascaleDbStorageVault(TrackedResource): + """ExascaleDbStorageVault resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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.ExascaleDbStorageVaultProperties + :ivar zones: The availability zones. + :vartype zones: list[str] + """ + + properties: Optional["_models.ExascaleDbStorageVaultProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + zones: Optional[List[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The availability zones.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ExascaleDbStorageVaultProperties"] = None, + zones: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExascaleDbStorageVaultProperties(_model_base.Model): + """ExascaleDbStorageVault resource model. + + :ivar additional_flash_cache_in_percent: The size of additional Flash Cache in percentage of + High Capacity database storage. + :vartype additional_flash_cache_in_percent: int + :ivar description: Exadata Database Storage Vault description. + :vartype description: str + :ivar display_name: The user-friendly name for the Exadata Database Storage Vault. The name + does not need to be unique. Required. + :vartype display_name: str + :ivar high_capacity_database_storage_input: Create exadata Database Storage Details. Required. + :vartype high_capacity_database_storage_input: + ~azure.mgmt.oracledatabase.models.ExascaleDbStorageInputDetails + :ivar high_capacity_database_storage: Response exadata Database Storage Details. + :vartype high_capacity_database_storage: + ~azure.mgmt.oracledatabase.models.ExascaleDbStorageDetails + :ivar time_zone: The time zone that you want to use for the Exadata Database Storage Vault. + :vartype time_zone: str + :ivar provisioning_state: Exadata Database Storage Vault provisioning state. Known values are: + "Succeeded", "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.AzureResourceProvisioningState + :ivar lifecycle_state: Exadata Database Storage Vault lifecycle state. Known values are: + "Provisioning", "Available", "Updating", "Terminating", "Terminated", and "Failed". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVaultLifecycleState + :ivar lifecycle_details: Additional information about the current lifecycle state. + :vartype lifecycle_details: str + :ivar vm_cluster_count: The number of Exadata VM clusters used the Exadata Database Storage + Vault. + :vartype vm_cluster_count: int + :ivar ocid: The OCID of the Exadata Database Storage Vault. + :vartype ocid: str + :ivar oci_url: HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + :vartype oci_url: str + """ + + additional_flash_cache_in_percent: Optional[int] = rest_field( + name="additionalFlashCacheInPercent", visibility=["read", "create"] + ) + """The size of additional Flash Cache in percentage of High Capacity database storage.""" + description: Optional[str] = rest_field(visibility=["read", "create"]) + """Exadata Database Storage Vault description.""" + display_name: str = rest_field(name="displayName", visibility=["read", "create"]) + """The user-friendly name for the Exadata Database Storage Vault. The name does not need to be + unique. Required.""" + high_capacity_database_storage_input: "_models.ExascaleDbStorageInputDetails" = rest_field( + name="highCapacityDatabaseStorageInput", visibility=["create"] + ) + """Create exadata Database Storage Details. Required.""" + high_capacity_database_storage: Optional["_models.ExascaleDbStorageDetails"] = rest_field( + name="highCapacityDatabaseStorage", visibility=["read"] + ) + """Response exadata Database Storage Details.""" + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create"]) + """The time zone that you want to use for the Exadata Database Storage Vault.""" + provisioning_state: Optional[Union[str, "_models.AzureResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Exadata Database Storage Vault provisioning state. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", and \"Provisioning\".""" + lifecycle_state: Optional[Union[str, "_models.ExascaleDbStorageVaultLifecycleState"]] = rest_field( + name="lifecycleState", visibility=["read"] + ) + """Exadata Database Storage Vault lifecycle state. Known values are: \"Provisioning\", + \"Available\", \"Updating\", \"Terminating\", \"Terminated\", and \"Failed\".""" + lifecycle_details: Optional[str] = rest_field(name="lifecycleDetails", visibility=["read"]) + """Additional information about the current lifecycle state.""" + vm_cluster_count: Optional[int] = rest_field(name="vmClusterCount", visibility=["read"]) + """The number of Exadata VM clusters used the Exadata Database Storage Vault.""" + ocid: Optional[str] = rest_field(visibility=["read"]) + """The OCID of the Exadata Database Storage Vault.""" + oci_url: Optional[str] = rest_field(name="ociUrl", visibility=["read"]) + """HTTPS link to OCI resources exposed to Azure Customer via Azure Interface.""" + + @overload + def __init__( + self, + *, + display_name: str, + high_capacity_database_storage_input: "_models.ExascaleDbStorageInputDetails", + additional_flash_cache_in_percent: Optional[int] = None, + description: Optional[str] = None, + time_zone: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExascaleDbStorageVaultTagsUpdate(_model_base.Model): + """The type used for updating tags in ExascaleDbStorageVault resources. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FileSystemConfigurationDetails(_model_base.Model): + """File configuration options. + + :ivar mount_point: Mount path. + :vartype mount_point: str + :ivar file_system_size_gb: Size of the VM. + :vartype file_system_size_gb: int + """ + + mount_point: Optional[str] = rest_field( + name="mountPoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Mount path.""" + file_system_size_gb: Optional[int] = rest_field( + name="fileSystemSizeGb", visibility=["read", "create", "update", "delete", "query"] + ) + """Size of the VM.""" + + @overload + def __init__( + self, + *, + mount_point: Optional[str] = None, + file_system_size_gb: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FlexComponent(ProxyResource): + """FlexComponent Resource Definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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.FlexComponentProperties + """ + + properties: Optional["_models.FlexComponentProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.FlexComponentProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FlexComponentProperties(_model_base.Model): + """FlexComponent resource model. + + :ivar minimum_core_count: The minimum number of CPU cores that can be enabled on the DB Server + for this Flex Component. + :vartype minimum_core_count: int + :ivar available_core_count: The maximum number of CPU cores that can be enabled on the DB + Server for this Flex Component. + :vartype available_core_count: int + :ivar available_db_storage_in_gbs: The maximum storage that can be enabled on the Storage + Server for this Flex Component. + :vartype available_db_storage_in_gbs: int + :ivar runtime_minimum_core_count: The runtime minimum number of CPU cores that can be enabled + for this Flex Component. + :vartype runtime_minimum_core_count: int + :ivar shape: The name of the DB system shape for this Flex Component. + :vartype shape: str + :ivar available_memory_in_gbs: The maximum memory size that can be enabled on the DB Server for + this Flex Component. + :vartype available_memory_in_gbs: int + :ivar available_local_storage_in_gbs: The maximum local storage that can be enabled on the DB + Server for this Flex Component. + :vartype available_local_storage_in_gbs: int + :ivar compute_model: The compute model of the DB Server for this Flex Component. + :vartype compute_model: str + :ivar hardware_type: The hardware type of the DB (Compute) or Storage (Cell) Server for this + Flex Component. Known values are: "COMPUTE" and "CELL". + :vartype hardware_type: str or ~azure.mgmt.oracledatabase.models.HardwareType + :ivar description_summary: The description summary for this Flex Component. + :vartype description_summary: str + """ + + minimum_core_count: Optional[int] = rest_field(name="minimumCoreCount", visibility=["read"]) + """The minimum number of CPU cores that can be enabled on the DB Server for this Flex Component.""" + available_core_count: Optional[int] = rest_field(name="availableCoreCount", visibility=["read"]) + """The maximum number of CPU cores that can be enabled on the DB Server for this Flex Component.""" + available_db_storage_in_gbs: Optional[int] = rest_field(name="availableDbStorageInGbs", visibility=["read"]) + """The maximum storage that can be enabled on the Storage Server for this Flex Component.""" + runtime_minimum_core_count: Optional[int] = rest_field(name="runtimeMinimumCoreCount", visibility=["read"]) + """The runtime minimum number of CPU cores that can be enabled for this Flex Component.""" + shape: Optional[str] = rest_field(visibility=["read"]) + """The name of the DB system shape for this Flex Component.""" + available_memory_in_gbs: Optional[int] = rest_field(name="availableMemoryInGbs", visibility=["read"]) + """The maximum memory size that can be enabled on the DB Server for this Flex Component.""" + available_local_storage_in_gbs: Optional[int] = rest_field(name="availableLocalStorageInGbs", visibility=["read"]) + """The maximum local storage that can be enabled on the DB Server for this Flex Component.""" + compute_model: Optional[str] = rest_field(name="computeModel", visibility=["read"]) + """The compute model of the DB Server for this Flex Component.""" + hardware_type: Optional[Union[str, "_models.HardwareType"]] = rest_field(name="hardwareType", visibility=["read"]) + """The hardware type of the DB (Compute) or Storage (Cell) Server for this Flex Component. Known + values are: \"COMPUTE\" and \"CELL\".""" + description_summary: Optional[str] = rest_field(name="descriptionSummary", visibility=["read"]) + """The description summary for this Flex Component.""" + + +class GenerateAutonomousDatabaseWalletDetails(_model_base.Model): + """Autonomous Database Generate Wallet resource model. + + :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 + """ + + generate_type: Optional[Union[str, "_models.GenerateType"]] = rest_field( + name="generateType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of wallet to generate. Known values are: \"Single\" and \"All\".""" + is_regional: Optional[bool] = rest_field( + name="isRegional", visibility=["read", "create", "update", "delete", "query"] + ) + """True when requesting regional connection strings in PDB connect info, applicable to + cross-region DG only.""" + password: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The password to encrypt the keys inside the wallet. Required.""" + + @overload + def __init__( + self, + *, + password: str, + generate_type: Optional[Union[str, "_models.GenerateType"]] = None, + is_regional: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GiMinorVersion(ProxyResource): + """The Oracle Grid Infrastructure (GI) minor version resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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.GiMinorVersionProperties + """ + + properties: Optional["_models.GiMinorVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.GiMinorVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GiMinorVersionProperties(_model_base.Model): + """The Oracle Grid Infrastructure (GI) minor version properties. + + :ivar version: A valid Oracle Grid Infrastructure (GI) software version. Required. + :vartype version: str + :ivar grid_image_ocid: Grid Infrastructure Image Id. + :vartype grid_image_ocid: str + """ + + version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A valid Oracle Grid Infrastructure (GI) software version. Required.""" + grid_image_ocid: Optional[str] = rest_field( + name="gridImageOcid", visibility=["read", "create", "update", "delete", "query"] + ) + """Grid Infrastructure Image Id.""" + + @overload + def __init__( + self, + *, + version: str, + grid_image_ocid: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GiVersion(ProxyResource): + """GiVersion resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.GiVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.GiVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GiVersionProperties(_model_base.Model): + """GiVersion resource model. + + :ivar version: A valid Oracle Grid Infrastructure (GI) software version. Required. + :vartype version: str + """ + + version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A valid Oracle Grid Infrastructure (GI) software version. Required.""" + + @overload + def __init__( + self, + *, + version: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LongTermBackUpScheduleDetails(_model_base.Model): + """Details for the long-term backup schedule. + + :ivar repeat_cadence: The frequency of the long-term backup schedule. Known values are: + "OneTime", "Weekly", "Monthly", and "Yearly". + :vartype repeat_cadence: str or ~azure.mgmt.oracledatabase.models.RepeatCadenceType + :ivar time_of_backup: The timestamp for the long-term backup schedule. For a MONTHLY cadence, + months having fewer days than the provided date will have the backup taken on the last day of + that month. + :vartype time_of_backup: ~datetime.datetime + :ivar retention_period_in_days: Retention period, in days, for backups. + :vartype retention_period_in_days: int + :ivar is_disabled: Indicates if the long-term backup schedule should be deleted. The default + value is ``FALSE``. + :vartype is_disabled: bool + """ + + repeat_cadence: Optional[Union[str, "_models.RepeatCadenceType"]] = rest_field( + name="repeatCadence", visibility=["read", "create", "update", "delete", "query"] + ) + """The frequency of the long-term backup schedule. Known values are: \"OneTime\", \"Weekly\", + \"Monthly\", and \"Yearly\".""" + time_of_backup: Optional[datetime.datetime] = rest_field( + name="timeOfBackup", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp for the long-term backup schedule. For a MONTHLY cadence, months having fewer + days than the provided date will have the backup taken on the last day of that month.""" + retention_period_in_days: Optional[int] = rest_field( + name="retentionPeriodInDays", visibility=["read", "create", "update", "delete", "query"] + ) + """Retention period, in days, for backups.""" + is_disabled: Optional[bool] = rest_field( + name="isDisabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates if the long-term backup schedule should be deleted. The default value is ``FALSE``.""" + + @overload + def __init__( + self, + *, + repeat_cadence: Optional[Union[str, "_models.RepeatCadenceType"]] = None, + time_of_backup: Optional[datetime.datetime] = None, + retention_period_in_days: Optional[int] = None, + is_disabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MaintenanceWindow(_model_base.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 + """ + + preference: Optional[Union[str, "_models.Preference"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The maintenance window scheduling preference. Known values are: \"NoPreference\" and + \"CustomPreference\".""" + months: Optional[List["_models.Month"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Months during the year when maintenance should be performed.""" + weeks_of_month: Optional[List[int]] = rest_field( + name="weeksOfMonth", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + days_of_week: Optional[List["_models.DayOfWeek"]] = rest_field( + name="daysOfWeek", visibility=["read", "create", "update", "delete", "query"] + ) + """Days during the week when maintenance should be performed.""" + hours_of_day: Optional[List[int]] = rest_field( + name="hoursOfDay", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + lead_time_in_weeks: Optional[int] = rest_field( + name="leadTimeInWeeks", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + patching_mode: Optional[Union[str, "_models.PatchingMode"]] = rest_field( + name="patchingMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Cloud Exadata infrastructure node patching method. Known values are: \"Rolling\" and + \"NonRolling\".""" + custom_action_timeout_in_mins: Optional[int] = rest_field( + name="customActionTimeoutInMins", visibility=["read", "create", "update", "delete", "query"] + ) + """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).""" + is_custom_action_timeout_enabled: Optional[bool] = rest_field( + name="isCustomActionTimeoutEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """If true, enables the configuration of a custom action timeout (waiting period) between database + server patching operations.""" + is_monthly_patching_enabled: Optional[bool] = rest_field( + name="isMonthlyPatchingEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """is Monthly Patching Enabled.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Month(_model_base.Model): + """Month resource properties. + + :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 + """ + + name: Union[str, "_models.MonthName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the month of the year. Required. Known values are: \"January\", \"February\", + \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", + \"November\", and \"December\".""" + + @overload + def __init__( + self, + *, + name: Union[str, "_models.MonthName"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NsgCidr(_model_base.Model): + """A rule for allowing inbound (INGRESS) IP packets. + + :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 + """ + + source: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Conceptually, this is the range of IP addresses that a packet coming into the instance can come + from. Required.""" + destination_port_range: Optional["_models.PortRange"] = rest_field( + name="destinationPortRange", visibility=["read", "create", "update", "delete", "query"] + ) + """Destination port range to specify particular destination ports for TCP rules.""" + + @overload + def __init__( + self, + *, + source: str, + destination_port_range: Optional["_models.PortRange"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_model_base.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + :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 Azure Resource Manager/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: Extensible 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 + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """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\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_model_base.Model): + """Localized display information for and operation. + + :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 + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class OracleSubscription(ProxyResource): + """OracleSubscription resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.OracleSubscriptionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Details of the resource plan.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.OracleSubscriptionProperties"] = None, + plan: Optional["_models.Plan"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OracleSubscriptionProperties(_model_base.Model): + """Oracle Subscription resource model. + + :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 + :ivar azure_subscription_ids: Azure subscriptions to be added. + :vartype azure_subscription_ids: list[str] + :ivar add_subscription_operation_state: State of the add Azure subscription operation on Oracle + subscription. Known values are: "Succeeded", "Updating", and "Failed". + :vartype add_subscription_operation_state: str or + ~azure.mgmt.oracledatabase.models.AddSubscriptionOperationState + :ivar last_operation_status_detail: Status details of the last operation on Oracle + subscription. + :vartype last_operation_status_detail: str + """ + + provisioning_state: Optional[Union[str, "_models.OracleSubscriptionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """OracleSubscriptionProvisioningState provisioning state. Known values are: \"Succeeded\", + \"Failed\", and \"Canceled\".""" + saas_subscription_id: Optional[str] = rest_field(name="saasSubscriptionId", visibility=["read"]) + """SAAS subscription ID generated by Marketplace.""" + cloud_account_id: Optional[str] = rest_field(name="cloudAccountId", visibility=["read"]) + """Cloud Account Id.""" + cloud_account_state: Optional[Union[str, "_models.CloudAccountProvisioningState"]] = rest_field( + name="cloudAccountState", visibility=["read"] + ) + """Cloud Account provisioning state. Known values are: \"Pending\", \"Provisioning\", and + \"Available\".""" + term_unit: Optional[str] = rest_field(name="termUnit", visibility=["read", "create"]) + """Term Unit. P1Y, P3Y, etc, see Durations `https://en.wikipedia.org/wiki/ISO_8601 + `_.""" + product_code: Optional[str] = rest_field(name="productCode", visibility=["update"]) + """Product code for the term unit.""" + intent: Optional[Union[str, "_models.Intent"]] = rest_field(visibility=["update"]) + """Intent for the update operation. Known values are: \"Retain\" and \"Reset\".""" + azure_subscription_ids: Optional[List[str]] = rest_field(name="azureSubscriptionIds", visibility=["read"]) + """Azure subscriptions to be added.""" + add_subscription_operation_state: Optional[Union[str, "_models.AddSubscriptionOperationState"]] = rest_field( + name="addSubscriptionOperationState", visibility=["read"] + ) + """State of the add Azure subscription operation on Oracle subscription. Known values are: + \"Succeeded\", \"Updating\", and \"Failed\".""" + last_operation_status_detail: Optional[str] = rest_field(name="lastOperationStatusDetail", visibility=["read"]) + """Status details of the last operation on Oracle subscription.""" + + @overload + def __init__( + self, + *, + term_unit: Optional[str] = None, + product_code: Optional[str] = None, + intent: Optional[Union[str, "_models.Intent"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OracleSubscriptionUpdate(_model_base.Model): + """The type used for update operations of the OracleSubscription. + + :ivar plan: Details of the resource plan. + :vartype plan: ~azure.mgmt.oracledatabase.models.PlanUpdate + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionUpdateProperties + """ + + plan: Optional["_models.PlanUpdate"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Details of the resource plan.""" + properties: Optional["_models.OracleSubscriptionUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + plan: Optional["_models.PlanUpdate"] = None, + properties: Optional["_models.OracleSubscriptionUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OracleSubscriptionUpdateProperties(_model_base.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 + """ + + product_code: Optional[str] = rest_field(name="productCode", visibility=["update"]) + """Product code for the term unit.""" + intent: Optional[Union[str, "_models.Intent"]] = rest_field(visibility=["update"]) + """Intent for the update operation. Known values are: \"Retain\" and \"Reset\".""" + + @overload + def __init__( + self, + *, + product_code: Optional[str] = None, + intent: Optional[Union[str, "_models.Intent"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PeerDbDetails(_model_base.Model): + """PeerDb Details. + + :ivar peer_db_id: The Azure resource ID of the Disaster Recovery peer database, which is + located in a different region from the current peer database. + :vartype peer_db_id: str + :ivar peer_db_ocid: Ocid of the Disaster Recovery peer database, which is located in a + different region from the current peer database. + :vartype peer_db_ocid: str + :ivar peer_db_location: The location of the Disaster Recovery peer database. + :vartype peer_db_location: str + """ + + peer_db_id: Optional[str] = rest_field(name="peerDbId", visibility=["read", "create", "update", "delete", "query"]) + """The Azure resource ID of the Disaster Recovery peer database, which is located in a different + region from the current peer database.""" + peer_db_ocid: Optional[str] = rest_field( + name="peerDbOcid", visibility=["read", "create", "update", "delete", "query"] + ) + """Ocid of the Disaster Recovery peer database, which is located in a different region from the + current peer database.""" + peer_db_location: Optional[str] = rest_field( + name="peerDbLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The location of the Disaster Recovery peer database.""" + + @overload + def __init__( + self, + *, + peer_db_id: Optional[str] = None, + peer_db_ocid: Optional[str] = None, + peer_db_location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Plan(_model_base.Model): + """Plan for the resource. + + :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 + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A user defined name of the 3rd Party Artifact that is being procured. Required.""" + publisher: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. Required.""" + product: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + promotion_code: Optional[str] = rest_field( + name="promotionCode", visibility=["read", "create", "update", "delete", "query"] + ) + """A publisher provided promotion code as provisioned in Data Market for the said + product/artifact.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version of the desired product/artifact.""" + + @overload + def __init__( + self, + *, + name: str, + publisher: str, + product: str, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PlanUpdate(_model_base.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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A user defined name of the 3rd Party Artifact that is being procured.""" + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic.""" + product: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + promotion_code: Optional[str] = rest_field( + name="promotionCode", visibility=["read", "create", "update", "delete", "query"] + ) + """A publisher provided promotion code as provisioned in Data Market for the said + product/artifact.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version of the desired product/artifact.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PortRange(_model_base.Model): + """Port Range to specify particular destination ports for TCP rules. + + :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 + """ + + min: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The minimum port number, which must not be greater than the maximum port number. Required.""" + max: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + + @overload + def __init__( + self, + *, + min: int, # pylint: disable=redefined-builtin + max: int, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateIpAddressesFilter(_model_base.Model): + """Private Ip Addresses filter. + + :ivar subnet_id: Subnet OCID. Required. + :vartype subnet_id: str + :ivar vnic_id: VCN OCID. Required. + :vartype vnic_id: str + """ + + subnet_id: str = rest_field(name="subnetId", visibility=["read", "create", "update", "delete", "query"]) + """Subnet OCID. Required.""" + vnic_id: str = rest_field(name="vnicId", visibility=["read", "create", "update", "delete", "query"]) + """VCN OCID. Required.""" + + @overload + def __init__( + self, + *, + subnet_id: str, + vnic_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateIpAddressProperties(_model_base.Model): + """PrivateIpAddress resource properties. + + :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 + """ + + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """PrivateIpAddresses displayName. Required.""" + hostname_label: str = rest_field(name="hostnameLabel", visibility=["read", "create", "update", "delete", "query"]) + """PrivateIpAddresses hostnameLabel. Required.""" + ocid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """PrivateIpAddresses Id. Required.""" + ip_address: str = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """PrivateIpAddresses ipAddress. Required.""" + subnet_id: str = rest_field(name="subnetId", visibility=["read", "create", "update", "delete", "query"]) + """PrivateIpAddresses subnetId. Required.""" + + @overload + def __init__( + self, + *, + display_name: str, + hostname_label: str, + ocid: str, + ip_address: str, + subnet_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProfileType(_model_base.Model): + """The connection string profile to allow clients to group, filter and select connection string + values based on structured metadata. + + :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 + """ + + consumer_group: Optional[Union[str, "_models.ConsumerGroup"]] = rest_field( + name="consumerGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Consumer group used by the connection. Known values are: \"High\", \"Medium\", \"Low\", \"Tp\", + and \"Tpurgent\".""" + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """A user-friendly name for the connection. Required.""" + host_format: Union[str, "_models.HostFormatType"] = rest_field( + name="hostFormat", visibility=["read", "create", "update", "delete", "query"] + ) + """Host format used in connection string. Required. Known values are: \"Fqdn\" and \"Ip\".""" + is_regional: Optional[bool] = rest_field( + name="isRegional", visibility=["read", "create", "update", "delete", "query"] + ) + """True for a regional connection string, applicable to cross-region DG only.""" + protocol: Union[str, "_models.ProtocolType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Protocol used by the connection. Required. Known values are: \"TCP\" and \"TCPS\".""" + session_mode: Union[str, "_models.SessionModeType"] = rest_field( + name="sessionMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the listener performs a direct hand-off of the session, or redirects the + session. Required. Known values are: \"Direct\" and \"Redirect\".""" + syntax_format: Union[str, "_models.SyntaxFormatType"] = rest_field( + name="syntaxFormat", visibility=["read", "create", "update", "delete", "query"] + ) + """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\".""" + tls_authentication: Optional[Union[str, "_models.TlsAuthenticationType"]] = rest_field( + name="tlsAuthentication", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the TLS handshake is using one-way (SERVER) or mutual (MUTUAL) + authentication. Known values are: \"Server\" and \"Mutual\".""" + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Connection string value. Required.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RemoveVirtualMachineFromExadbVmClusterDetails(_model_base.Model): # pylint: disable=name-too-long + """Details of removing Virtual Machines from the Exadata VM cluster on Exascale Infrastructure. + Applies to Exadata Database Service on Exascale Infrastructure only. + + :ivar db_nodes: The list of ExaCS DB nodes for the Exadata VM cluster on Exascale + Infrastructure to be removed. Required. + :vartype db_nodes: list[~azure.mgmt.oracledatabase.models.DbNodeDetails] + """ + + db_nodes: List["_models.DbNodeDetails"] = rest_field( + name="dbNodes", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of ExaCS DB nodes for the Exadata VM cluster on Exascale Infrastructure to be removed. + Required.""" + + @overload + def __init__( + self, + *, + db_nodes: List["_models.DbNodeDetails"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestoreAutonomousDatabaseDetails(_model_base.Model): + """Details to restore an Oracle Autonomous Database. + + :ivar timestamp: The time to restore the database to. Required. + :vartype timestamp: ~datetime.datetime + """ + + timestamp: datetime.datetime = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time to restore the database to. Required.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduledOperationsType(_model_base.Model): + """The list of scheduled operations. + + :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 + """ + + day_of_week: "_models.DayOfWeek" = rest_field( + name="dayOfWeek", visibility=["read", "create", "update", "delete", "query"] + ) + """Day of week. Required.""" + scheduled_start_time: Optional[str] = rest_field( + name="scheduledStartTime", visibility=["read", "create", "update", "delete", "query"] + ) + """auto start time. value must be of ISO-8601 format HH:mm.""" + scheduled_stop_time: Optional[str] = rest_field( + name="scheduledStopTime", visibility=["read", "create", "update", "delete", "query"] + ) + """auto stop time. value must be of ISO-8601 format HH:mm.""" + + @overload + def __init__( + self, + *, + day_of_week: "_models.DayOfWeek", + scheduled_start_time: Optional[str] = None, + scheduled_stop_time: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_model_base.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 + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemVersion(ProxyResource): + """SystemVersion resource Definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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.SystemVersionProperties + """ + + properties: Optional["_models.SystemVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.SystemVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemVersionProperties(_model_base.Model): + """System Version Resource model. + + :ivar system_version: A valid Oracle System Version. Required. + :vartype system_version: str + """ + + system_version: str = rest_field(name="systemVersion", visibility=["read", "create", "update", "delete", "query"]) + """A valid Oracle System Version. Required.""" + + @overload + def __init__( + self, + *, + system_version: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualNetworkAddress(ProxyResource): + """Virtual IP resource belonging to a vm cluster resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + """ + + properties: Optional["_models.VirtualNetworkAddressProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.VirtualNetworkAddressProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualNetworkAddressProperties(_model_base.Model): + """virtualNetworkAddress resource properties. + + :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 + """ + + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create"]) + """Virtual network Address address.""" + vm_ocid: Optional[str] = rest_field(name="vmOcid", visibility=["read", "create"]) + """Virtual Machine OCID.""" + ocid: Optional[str] = rest_field(visibility=["read"]) + """Application VIP OCID.""" + domain: Optional[str] = rest_field(visibility=["read"]) + """Virtual network address fully qualified domain name.""" + lifecycle_details: Optional[str] = rest_field(name="lifecycleDetails", visibility=["read"]) + """Additional information about the current lifecycle state of the application virtual IP (VIP) + address.""" + provisioning_state: Optional[Union[str, "_models.AzureResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Azure resource provisioning state. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", + and \"Provisioning\".""" + lifecycle_state: Optional[Union[str, "_models.VirtualNetworkAddressLifecycleState"]] = rest_field( + name="lifecycleState", visibility=["read"] + ) + """virtual network address lifecycle state. Known values are: \"Provisioning\", \"Available\", + \"Terminating\", \"Terminated\", and \"Failed\".""" + time_assigned: Optional[datetime.datetime] = rest_field(name="timeAssigned", visibility=["read"], format="rfc3339") + """The date and time when the create operation for the application virtual IP (VIP) address + completed.""" + + @overload + def __init__( + self, + *, + ip_address: Optional[str] = None, + vm_ocid: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/oracledatabase/arm-oracledatabase/models/_patch.py b/sdk/oracledatabase/arm-oracledatabase/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/oracledatabase/arm-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/oracledatabase/arm-oracledatabase/operations/__init__.py b/sdk/oracledatabase/arm-oracledatabase/operations/__init__.py new file mode 100644 index 000000000000..f84dee0a8172 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/operations/__init__.py @@ -0,0 +1,69 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import CloudExadataInfrastructuresOperations # type: ignore +from ._operations import ListActionsOperations # type: ignore +from ._operations import DbServersOperations # type: ignore +from ._operations import CloudVmClustersOperations # type: ignore +from ._operations import VirtualNetworkAddressesOperations # type: ignore +from ._operations import SystemVersionsOperations # type: ignore +from ._operations import OracleSubscriptionsOperations # type: ignore +from ._operations import DbNodesOperations # type: ignore +from ._operations import GiVersionsOperations # type: ignore +from ._operations import GiMinorVersionsOperations # type: ignore +from ._operations import DbSystemShapesOperations # type: ignore +from ._operations import DnsPrivateViewsOperations # type: ignore +from ._operations import DnsPrivateZonesOperations # type: ignore +from ._operations import FlexComponentsOperations # type: ignore +from ._operations import AutonomousDatabasesOperations # type: ignore +from ._operations import AutonomousDatabaseBackupsOperations # type: ignore +from ._operations import AutonomousDatabaseCharacterSetsOperations # type: ignore +from ._operations import AutonomousDatabaseNationalCharacterSetsOperations # type: ignore +from ._operations import AutonomousDatabaseVersionsOperations # type: ignore +from ._operations import ExadbVmClustersOperations # type: ignore +from ._operations import ExascaleDbNodesOperations # type: ignore +from ._operations import ExascaleDbStorageVaultsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "CloudExadataInfrastructuresOperations", + "ListActionsOperations", + "DbServersOperations", + "CloudVmClustersOperations", + "VirtualNetworkAddressesOperations", + "SystemVersionsOperations", + "OracleSubscriptionsOperations", + "DbNodesOperations", + "GiVersionsOperations", + "GiMinorVersionsOperations", + "DbSystemShapesOperations", + "DnsPrivateViewsOperations", + "DnsPrivateZonesOperations", + "FlexComponentsOperations", + "AutonomousDatabasesOperations", + "AutonomousDatabaseBackupsOperations", + "AutonomousDatabaseCharacterSetsOperations", + "AutonomousDatabaseNationalCharacterSetsOperations", + "AutonomousDatabaseVersionsOperations", + "ExadbVmClustersOperations", + "ExascaleDbNodesOperations", + "ExascaleDbStorageVaultsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/oracledatabase/arm-oracledatabase/operations/_operations.py b/sdk/oracledatabase/arm-oracledatabase/operations/_operations.py new file mode 100644 index 000000000000..59dd42614f0c --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/operations/_operations.py @@ -0,0 +1,14756 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._configuration import OracleDatabaseMgmtClientConfiguration +from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._serialization import Deserializer, Serializer +from .._validation import api_version_validation + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_operations_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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) + + +def build_cloud_exadata_infrastructures_list_by_subscription_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/cloudExadataInfrastructures" + 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_cloud_exadata_infrastructures_create_or_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_exadata_infrastructures_get_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_exadata_infrastructures_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_exadata_infrastructures_delete_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_exadata_infrastructures_list_by_resource_group_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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_cloud_exadata_infrastructures_add_storage_capacity_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/addStorageCapacity" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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) + + +def build_db_servers_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/dbServers/{dbserverocid}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudexadatainfrastructurename": _SERIALIZER.url( + "cloudexadatainfrastructurename", cloudexadatainfrastructurename, "str" + ), + "dbserverocid": _SERIALIZER.url("dbserverocid", dbserverocid, "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_db_servers_list_by_parent_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/dbServers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_vm_clusters_list_by_subscription_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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_cloud_vm_clusters_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_vm_clusters_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_vm_clusters_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_vm_clusters_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_vm_clusters_list_by_resource_group_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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_cloud_vm_clusters_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/addVms" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_vm_clusters_remove_vms_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/removeVms" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_cloud_vm_clusters_list_private_ip_addresses_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/listPrivateIpAddresses" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_virtual_network_addresses_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "virtualnetworkaddressname": _SERIALIZER.url("virtualnetworkaddressname", virtualnetworkaddressname, "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_virtual_network_addresses_get_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "virtualnetworkaddressname": _SERIALIZER.url("virtualnetworkaddressname", virtualnetworkaddressname, "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_virtual_network_addresses_delete_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "virtualnetworkaddressname": _SERIALIZER.url("virtualnetworkaddressname", virtualnetworkaddressname, "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_virtual_network_addresses_list_by_parent_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_system_versions_get_request( + location: str, systemversionname: 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/systemVersions/{systemversionname}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "systemversionname": _SERIALIZER.url("systemversionname", systemversionname, "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_system_versions_list_by_location_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/systemVersions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_oracle_subscriptions_list_by_subscription_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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_oracle_subscriptions_create_or_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + 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_oracle_subscriptions_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + 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_oracle_subscriptions_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + 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_oracle_subscriptions_delete_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + 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_oracle_subscriptions_list_cloud_account_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listCloudAccountDetails" + ) + 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_oracle_subscriptions_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listSaasSubscriptionDetails" + 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_oracle_subscriptions_list_activation_links_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listActivationLinks" + 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_oracle_subscriptions_add_azure_subscriptions_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/addAzureSubscriptions" + 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_db_nodes_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes/{dbnodeocid}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "dbnodeocid": _SERIALIZER.url("dbnodeocid", dbnodeocid, "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_db_nodes_list_by_parent_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_db_nodes_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes/{dbnodeocid}/action" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "dbnodeocid": _SERIALIZER.url("dbnodeocid", dbnodeocid, "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_gi_versions_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions/{giversionname}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "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) + + +def build_gi_versions_list_by_location_request( # pylint: disable=name-too-long + location: str, + subscription_id: str, + *, + shape: Optional[Union[str, _models.SystemShapes]] = None, + zone: Optional[str] = None, + **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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shape is not None: + _params["shape"] = _SERIALIZER.query("shape", shape, "str") + if zone is not None: + _params["zone"] = _SERIALIZER.query("zone", zone, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gi_minor_versions_list_by_parent_request( # pylint: disable=name-too-long + location: str, + giversionname: str, + subscription_id: str, + *, + shape_family: Optional[Union[str, _models.ShapeFamily]] = None, + zone: Optional[str] = None, + **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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions/{giversionname}/giMinorVersions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "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") + if shape_family is not None: + _params["shapeFamily"] = _SERIALIZER.query("shape_family", shape_family, "str") + if zone is not None: + _params["zone"] = _SERIALIZER.query("zone", zone, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gi_minor_versions_get_request( + location: str, giversionname: str, gi_minor_version_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions/{giversionname}/giMinorVersions/{giMinorVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "giversionname": _SERIALIZER.url("giversionname", giversionname, "str"), + "giMinorVersionName": _SERIALIZER.url("gi_minor_version_name", gi_minor_version_name, "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_db_system_shapes_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dbSystemShapes/{dbsystemshapename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "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) + + +def build_db_system_shapes_list_by_location_request( # pylint: disable=name-too-long + location: str, subscription_id: str, *, zone: Optional[str] = None, **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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dbSystemShapes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if zone is not None: + _params["zone"] = _SERIALIZER.query("zone", zone, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dns_private_views_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateViews/{dnsprivateviewocid}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "dnsprivateviewocid": _SERIALIZER.url("dnsprivateviewocid", dnsprivateviewocid, "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_dns_private_views_list_by_location_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateViews" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_dns_private_zones_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateZones/{dnsprivatezonename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "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) + + +def build_dns_private_zones_list_by_location_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateZones" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_flex_components_get_request( + location: str, flex_component_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/flexComponents/{flexComponentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "flexComponentName": _SERIALIZER.url("flex_component_name", flex_component_name, "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_flex_components_list_by_parent_request( # pylint: disable=name-too-long + location: str, subscription_id: str, *, shape: Optional[Union[str, _models.SystemShapes]] = None, **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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/flexComponents" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shape is not None: + _params["shape"] = _SERIALIZER.query("shape", shape, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_autonomous_databases_list_by_subscription_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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_autonomous_databases_create_or_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_databases_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_databases_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_databases_delete_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_databases_list_by_resource_group_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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_autonomous_databases_switchover_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/switchover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_databases_failover_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/failover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_databases_generate_wallet_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/generateWallet" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_databases_restore_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/restore" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_databases_shrink_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/shrink" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_databases_change_disaster_recovery_configuration_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/changeDisasterRecoveryConfiguration" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_database_backups_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "str"), + "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_autonomous_database_backups_get_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "str"), + "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_autonomous_database_backups_delete_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "str"), + "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) + + +def build_autonomous_database_backups_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "str"), + "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_autonomous_database_backups_list_by_parent_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "autonomousdatabasename": _SERIALIZER.url("autonomousdatabasename", autonomousdatabasename, "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_autonomous_database_character_sets_get_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseCharacterSets/{adbscharsetname}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "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) + + +def build_autonomous_database_character_sets_list_by_location_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseCharacterSets" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_autonomous_database_national_character_sets_get_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseNationalCharacterSets/{adbsncharsetname}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "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) + + +def build_autonomous_database_national_character_sets_list_by_location_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseNationalCharacterSets" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_autonomous_database_versions_get_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDbVersions/{autonomousdbversionsname}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "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) + + +def build_autonomous_database_versions_list_by_location_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDbVersions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_exadb_vm_clusters_list_by_subscription_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/exadbVmClusters" + 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_exadb_vm_clusters_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, exadb_vm_cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exadbVmClusterName": _SERIALIZER.url("exadb_vm_cluster_name", exadb_vm_cluster_name, "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_exadb_vm_clusters_get_request( + resource_group_name: str, exadb_vm_cluster_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exadbVmClusterName": _SERIALIZER.url("exadb_vm_cluster_name", exadb_vm_cluster_name, "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_exadb_vm_clusters_update_request( + resource_group_name: str, exadb_vm_cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exadbVmClusterName": _SERIALIZER.url("exadb_vm_cluster_name", exadb_vm_cluster_name, "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_exadb_vm_clusters_delete_request( + resource_group_name: str, exadb_vm_cluster_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exadbVmClusterName": _SERIALIZER.url("exadb_vm_cluster_name", exadb_vm_cluster_name, "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_exadb_vm_clusters_list_by_resource_group_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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_exadb_vm_clusters_remove_vms_request( # pylint: disable=name-too-long + resource_group_name: str, exadb_vm_cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}/removeVms" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exadbVmClusterName": _SERIALIZER.url("exadb_vm_cluster_name", exadb_vm_cluster_name, "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_exascale_db_nodes_get_request( + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}/dbNodes/{exascaleDbNodeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exadbVmClusterName": _SERIALIZER.url("exadb_vm_cluster_name", exadb_vm_cluster_name, "str"), + "exascaleDbNodeName": _SERIALIZER.url("exascale_db_node_name", exascale_db_node_name, "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_exascale_db_nodes_list_by_parent_request( # pylint: disable=name-too-long + resource_group_name: str, exadb_vm_cluster_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}/dbNodes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exadbVmClusterName": _SERIALIZER.url("exadb_vm_cluster_name", exadb_vm_cluster_name, "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_exascale_db_nodes_action_request( + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}/dbNodes/{exascaleDbNodeName}/action" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exadbVmClusterName": _SERIALIZER.url("exadb_vm_cluster_name", exadb_vm_cluster_name, "str"), + "exascaleDbNodeName": _SERIALIZER.url("exascale_db_node_name", exascale_db_node_name, "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_exascale_db_storage_vaults_get_request( # pylint: disable=name-too-long + resource_group_name: str, exascale_db_storage_vault_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults/{exascaleDbStorageVaultName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exascaleDbStorageVaultName": _SERIALIZER.url( + "exascale_db_storage_vault_name", exascale_db_storage_vault_name, "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_exascale_db_storage_vaults_create_request( # pylint: disable=name-too-long + resource_group_name: str, exascale_db_storage_vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults/{exascaleDbStorageVaultName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exascaleDbStorageVaultName": _SERIALIZER.url( + "exascale_db_storage_vault_name", exascale_db_storage_vault_name, "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_exascale_db_storage_vaults_update_request( # pylint: disable=name-too-long + resource_group_name: str, exascale_db_storage_vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults/{exascaleDbStorageVaultName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exascaleDbStorageVaultName": _SERIALIZER.url( + "exascale_db_storage_vault_name", exascale_db_storage_vault_name, "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_exascale_db_storage_vaults_delete_request( # pylint: disable=name-too-long + resource_group_name: str, exascale_db_storage_vault_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults/{exascaleDbStorageVaultName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "exascaleDbStorageVaultName": _SERIALIZER.url( + "exascale_db_storage_vault_name", exascale_db_storage_vault_name, "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_exascale_db_storage_vaults_list_by_resource_group_request( # pylint: disable=name-too-long + 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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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_exascale_db_storage_vaults_list_by_subscription_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", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Oracle.Database/exascaleDbStorageVaults" + 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) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 CloudExadataInfrastructure + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudExadataInfrastructure]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_cloud_exadata_infrastructures_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CloudExadataInfrastructure], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _create_or_update_initial( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: Union[_models.CloudExadataInfrastructure, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_exadata_infrastructures_create_or_update_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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, JSON, 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 one of the following types: + CloudExadataInfrastructure, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure or JSON or + IO[bytes] + :return: An instance of LROPoller that returns CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CloudExadataInfrastructure, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The CloudExadataInfrastructure is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + + _request = build_cloud_exadata_infrastructures_get_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CloudExadataInfrastructure, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: Union[_models.CloudExadataInfrastructureUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_exadata_infrastructures_update_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :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, JSON, 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 one of the following types: + CloudExadataInfrastructureUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CloudExadataInfrastructure, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_exadata_infrastructures_delete_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @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 CloudExadataInfrastructure + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudExadataInfrastructure]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_cloud_exadata_infrastructures_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CloudExadataInfrastructure], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _add_storage_capacity_initial( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_exadata_infrastructures_add_storage_capacity_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudExadataInfrastructure. The + CloudExadataInfrastructure is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.CloudExadataInfrastructure, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + +class ListActionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`list_actions` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DbServer is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DbServer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DbServer] = kwargs.pop("cls", None) + + _request = build_db_servers_get_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + dbserverocid=dbserverocid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DbServer, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_parent( + 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 DbServer + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DbServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DbServer]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_db_servers_list_by_parent_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DbServer], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 CloudVmCluster + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_cloud_vm_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CloudVmCluster], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _create_or_update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: Union[_models.CloudVmCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_create_or_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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, JSON, 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 one of the following types: CloudVmCluster, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudVmCluster or JSON or IO[bytes] + :return: An instance of LROPoller that returns CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The CloudVmCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.CloudVmCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + + _request = build_cloud_vm_clusters_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: Union[_models.CloudVmClusterUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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, JSON, 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 one of the following types: + CloudVmClusterUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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(self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_vm_clusters_delete_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @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 CloudVmCluster + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_cloud_vm_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CloudVmCluster], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _add_vms_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_add_vms_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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, JSON, 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 one of the following types: AddRemoveDbNode, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode or JSON or IO[bytes] + :return: An instance of LROPoller that returns CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _remove_vms_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_remove_vms_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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: JSON, + *, + 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: JSON + :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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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 CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :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, JSON, 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 one of the following types: AddRemoveDbNode, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode or JSON or IO[bytes] + :return: An instance of LROPoller that returns CloudVmCluster. The CloudVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.CloudVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + :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: JSON, + *, + 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: JSON + :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 + :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 + :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, JSON, 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 one of the following types: + PrivateIpAddressesFilter, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.PrivateIpAddressesFilter or JSON or IO[bytes] + :return: list of PrivateIpAddressProperties + :rtype: list[~azure.mgmt.oracledatabase.models.PrivateIpAddressProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_vm_clusters_list_private_ip_addresses_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.PrivateIpAddressProperties], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_or_update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: Union[_models.VirtualNetworkAddress, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_network_addresses_create_or_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 VirtualNetworkAddress. The VirtualNetworkAddress + is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 VirtualNetworkAddress. The VirtualNetworkAddress + is compatible with MutableMapping + :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 VirtualNetworkAddress. The VirtualNetworkAddress + is compatible with MutableMapping + :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, JSON, 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 one of the following types: + VirtualNetworkAddress, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress or JSON or IO[bytes] + :return: An instance of LROPoller that returns VirtualNetworkAddress. The VirtualNetworkAddress + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualNetworkAddress, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The VirtualNetworkAddress is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualNetworkAddress] = kwargs.pop("cls", None) + + _request = build_virtual_network_addresses_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualNetworkAddress, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, cloudvmclustername: str, virtualnetworkaddressname: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_network_addresses_delete_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @distributed_trace + def list_by_parent( + 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 VirtualNetworkAddress + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualNetworkAddress]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_virtual_network_addresses_list_by_parent_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualNetworkAddress], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SystemVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`system_versions` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, location: str, systemversionname: str, **kwargs: Any) -> _models.SystemVersion: + """Get a SystemVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param systemversionname: SystemVersion name. Required. + :type systemversionname: str + :return: SystemVersion. The SystemVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.SystemVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SystemVersion] = kwargs.pop("cls", None) + + _request = build_system_versions_get_request( + location=location, + systemversionname=systemversionname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SystemVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.SystemVersion"]: + """List SystemVersion resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of SystemVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.SystemVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SystemVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_system_versions_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SystemVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 OracleSubscription + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OracleSubscription]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_oracle_subscriptions_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OracleSubscription], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _create_or_update_initial( + self, resource: Union[_models.OracleSubscription, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_oracle_subscriptions_create_or_update_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 OracleSubscription. The OracleSubscription is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, resource: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 OracleSubscription. The OracleSubscription is + compatible with MutableMapping + :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 OracleSubscription. The OracleSubscription is + compatible with MutableMapping + :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, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Is one of the following types: OracleSubscription, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.OracleSubscription or JSON or IO[bytes] + :return: An instance of LROPoller that returns OracleSubscription. The OracleSubscription is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OracleSubscription, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace + def get(self, **kwargs: Any) -> _models.OracleSubscription: + """Get a OracleSubscription. + + :return: OracleSubscription. The OracleSubscription is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.OracleSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_get_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OracleSubscription, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, properties: Union[_models.OracleSubscriptionUpdate, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_oracle_subscriptions_update_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 OracleSubscription. The OracleSubscription is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, properties: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :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 OracleSubscription. The OracleSubscription is + compatible with MutableMapping + :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 OracleSubscription. The OracleSubscription is + compatible with MutableMapping + :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, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Is one of the following types: + OracleSubscriptionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns OracleSubscription. The OracleSubscription is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OracleSubscription, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_delete_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, **kwargs: Any) -> LROPoller[None]: + """Delete a OracleSubscription. + + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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(cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_cloud_account_details_initial(self, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_list_cloud_account_details_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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[None]: + """List Cloud Account Details. + + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._list_cloud_account_details_initial( + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_saas_subscription_details_initial(self, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_list_saas_subscription_details_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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[None]: + """List Saas Subscription Details. + + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._list_saas_subscription_details_initial( + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_oracle_subscriptions_list_activation_links_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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[None]: + """List Activation Links. + + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._list_activation_links_initial( + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @api_version_validation( + method_added_on="2024-06-01-preview", + params_added_on={"2024-06-01-preview": ["api_version", "subscription_id", "content_type", "accept"]}, + ) + def _add_azure_subscriptions_initial( + self, body: Union[_models.AzureSubscriptions, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_oracle_subscriptions_add_azure_subscriptions_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_add_azure_subscriptions( + self, body: _models.AzureSubscriptions, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Add Azure Subscriptions. + + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.AzureSubscriptions + :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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_add_azure_subscriptions( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Add Azure Subscriptions. + + :param body: The content of the action request. Required. + :type body: JSON + :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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_add_azure_subscriptions( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Add Azure Subscriptions. + + :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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2024-06-01-preview", + params_added_on={"2024-06-01-preview": ["api_version", "subscription_id", "content_type", "accept"]}, + ) + def begin_add_azure_subscriptions( + self, body: Union[_models.AzureSubscriptions, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Add Azure Subscriptions. + + :param body: The content of the action request. Is one of the following types: + AzureSubscriptions, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.AzureSubscriptions or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + 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._add_azure_subscriptions_initial( + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DbNode is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DbNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DbNode] = kwargs.pop("cls", None) + + _request = build_db_nodes_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DbNode, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_parent( + 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 DbNode + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DbNode]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_db_nodes_list_by_parent_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DbNode], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _action_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: Union[_models.DbNodeAction, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_db_nodes_action_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 DbNode. The DbNode is compatible with + MutableMapping + :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: JSON, + *, + 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: JSON + :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 DbNode. The DbNode is compatible with + MutableMapping + :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 DbNode. The DbNode is compatible with + MutableMapping + :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, JSON, 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 one of the following types: DbNodeAction, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.DbNodeAction or JSON or IO[bytes] + :return: An instance of LROPoller that returns DbNode. The DbNode is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.DbNode, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The GiVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.GiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GiVersion] = kwargs.pop("cls", None) + + _request = build_gi_versions_get_request( + location=location, + giversionname=giversionname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GiVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": ["api_version", "subscription_id", "location", "shape", "zone", "accept"] + }, + ) + def list_by_location( + self, + location: str, + *, + shape: Optional[Union[str, _models.SystemShapes]] = None, + zone: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.GiVersion"]: + """List GiVersion resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword shape: If provided, filters the results for the given shape. Known values are: + "Exadata.X9M", "Exadata.X11M", and "ExaDbXS". Default value is None. + :paramtype shape: str or ~azure.mgmt.oracledatabase.models.SystemShapes + :keyword zone: Filters the result for the given Azure Availability Zone. Default value is None. + :paramtype zone: str + :return: An iterator like instance of GiVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.GiVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GiVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_gi_versions_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + shape=shape, + zone=zone, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GiVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class GiMinorVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`gi_minor_versions` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "location", + "giversionname", + "shape_family", + "zone", + "accept", + ] + }, + ) + def list_by_parent( + self, + location: str, + giversionname: str, + *, + shape_family: Optional[Union[str, _models.ShapeFamily]] = None, + zone: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.GiMinorVersion"]: + """List GiMinorVersion resources by GiVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param giversionname: GiVersion name. Required. + :type giversionname: str + :keyword shape_family: If provided, filters the results to the set of database versions which + are supported for the given shape family. Known values are: "EXADATA" and "EXADB_XS". Default + value is None. + :paramtype shape_family: str or ~azure.mgmt.oracledatabase.models.ShapeFamily + :keyword zone: Filters the result for the given Azure Availability Zone. Default value is None. + :paramtype zone: str + :return: An iterator like instance of GiMinorVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.GiMinorVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GiMinorVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_gi_minor_versions_list_by_parent_request( + location=location, + giversionname=giversionname, + subscription_id=self._config.subscription_id, + shape_family=shape_family, + zone=zone, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GiMinorVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "location", + "giversionname", + "gi_minor_version_name", + "accept", + ] + }, + ) + def get( + self, location: str, giversionname: str, gi_minor_version_name: str, **kwargs: Any + ) -> _models.GiMinorVersion: + """Get a GiMinorVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param giversionname: GiVersion name. Required. + :type giversionname: str + :param gi_minor_version_name: The name of the GiMinorVersion. Required. + :type gi_minor_version_name: str + :return: GiMinorVersion. The GiMinorVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.GiMinorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GiMinorVersion] = kwargs.pop("cls", None) + + _request = build_gi_minor_versions_get_request( + location=location, + giversionname=giversionname, + gi_minor_version_name=gi_minor_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GiMinorVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DbSystemShape is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DbSystemShape + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DbSystemShape] = kwargs.pop("cls", None) + + _request = build_db_system_shapes_get_request( + location=location, + dbsystemshapename=dbsystemshapename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DbSystemShape, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "location", "zone", "accept"]}, + ) + def list_by_location( + self, location: str, *, zone: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.DbSystemShape"]: + """List DbSystemShape resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword zone: Filters the result for the given Azure Availability Zone. Default value is None. + :paramtype zone: str + :return: An iterator like instance of DbSystemShape + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DbSystemShape] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DbSystemShape]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_db_system_shapes_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + zone=zone, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DbSystemShape], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DnsPrivateView is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DnsPrivateView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DnsPrivateView] = kwargs.pop("cls", None) + + _request = build_dns_private_views_get_request( + location=location, + dnsprivateviewocid=dnsprivateviewocid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DnsPrivateView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.DnsPrivateView"]: + """List DnsPrivateView resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of DnsPrivateView + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DnsPrivateView] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DnsPrivateView]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_dns_private_views_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DnsPrivateView], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The DnsPrivateZone is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.DnsPrivateZone + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DnsPrivateZone] = kwargs.pop("cls", None) + + _request = build_dns_private_zones_get_request( + location=location, + dnsprivatezonename=dnsprivatezonename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DnsPrivateZone, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.DnsPrivateZone"]: + """List DnsPrivateZone resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of DnsPrivateZone + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DnsPrivateZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DnsPrivateZone]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_dns_private_zones_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DnsPrivateZone], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class FlexComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`flex_components` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2025-01-01-preview", + params_added_on={ + "2025-01-01-preview": ["api_version", "subscription_id", "location", "flex_component_name", "accept"] + }, + ) + def get(self, location: str, flex_component_name: str, **kwargs: Any) -> _models.FlexComponent: + """Get a FlexComponent. + + :param location: The name of the Azure region. Required. + :type location: str + :param flex_component_name: The name of the FlexComponent. Required. + :type flex_component_name: str + :return: FlexComponent. The FlexComponent is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.FlexComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FlexComponent] = kwargs.pop("cls", None) + + _request = build_flex_components_get_request( + location=location, + flex_component_name=flex_component_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FlexComponent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2025-01-01-preview", + params_added_on={"2025-01-01-preview": ["api_version", "subscription_id", "location", "shape", "accept"]}, + ) + def list_by_parent( + self, location: str, *, shape: Optional[Union[str, _models.SystemShapes]] = None, **kwargs: Any + ) -> Iterable["_models.FlexComponent"]: + """List FlexComponent resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword shape: If provided, filters the results for the given shape. Known values are: + "Exadata.X9M", "Exadata.X11M", and "ExaDbXS". Default value is None. + :paramtype shape: str or ~azure.mgmt.oracledatabase.models.SystemShapes + :return: An iterator like instance of FlexComponent + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.FlexComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FlexComponent]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_flex_components_list_by_parent_request( + location=location, + subscription_id=self._config.subscription_id, + shape=shape, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FlexComponent], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 AutonomousDatabase + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_databases_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDatabase], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _create_or_update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: Union[_models.AutonomousDatabase, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_create_or_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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, JSON, 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 one of the following types: AutonomousDatabase, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabase or JSON or IO[bytes] + :return: An instance of LROPoller that returns AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The AutonomousDatabase is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + + _request = build_autonomous_databases_get_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: Union[_models.AutonomousDatabaseUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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, JSON, 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 one of the following types: + AutonomousDatabaseUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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(self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_autonomous_databases_delete_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @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 AutonomousDatabase + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_databases_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDatabase], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _switchover_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_switchover_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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, JSON, 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 one of the following types: PeerDbDetails, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails or JSON or IO[bytes] + :return: An instance of LROPoller that returns AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _failover_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_failover_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :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, JSON, 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 one of the following types: PeerDbDetails, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails or JSON or IO[bytes] + :return: An instance of LROPoller that returns AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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. The AutonomousDatabaseWalletFile is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def generate_wallet( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: JSON, + *, + 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutonomousDatabaseWalletFile. The AutonomousDatabaseWalletFile is compatible with + MutableMapping + :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. The AutonomousDatabaseWalletFile is compatible with + MutableMapping + :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, JSON, 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 one of the following types: + GenerateAutonomousDatabaseWalletDetails, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.GenerateAutonomousDatabaseWalletDetails or JSON + or IO[bytes] + :return: AutonomousDatabaseWalletFile. The AutonomousDatabaseWalletFile is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_generate_wallet_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabaseWalletFile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _restore_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.RestoreAutonomousDatabaseDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_restore_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_restore( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.RestoreAutonomousDatabaseDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Restores an Autonomous Database based on the provided request parameters. + + :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.RestoreAutonomousDatabaseDetails + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_restore( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Restores an Autonomous Database based on the provided request parameters. + + :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: JSON + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_restore( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Restores an Autonomous Database based on the provided request parameters. + + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_restore( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.RestoreAutonomousDatabaseDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Restores an Autonomous Database based on the provided request parameters. + + :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 one of the following types: + RestoreAutonomousDatabaseDetails, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.RestoreAutonomousDatabaseDetails or JSON or + IO[bytes] + :return: An instance of LROPoller that returns AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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._restore_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _shrink_initial(self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_autonomous_databases_shrink_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_shrink( + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """This operation shrinks the current allocated storage down to the current actual used data + storage. + + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._shrink_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @api_version_validation( + method_added_on="2024-10-01-preview", + params_added_on={ + "2024-10-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "autonomousdatabasename", + "content_type", + "accept", + ] + }, + ) + def _change_disaster_recovery_configuration_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.DisasterRecoveryConfigurationDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_databases_change_disaster_recovery_configuration_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_change_disaster_recovery_configuration( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.DisasterRecoveryConfigurationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform ChangeDisasterRecoveryConfiguration 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.DisasterRecoveryConfigurationDetails + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_change_disaster_recovery_configuration( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform ChangeDisasterRecoveryConfiguration 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: JSON + :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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_change_disaster_recovery_configuration( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform ChangeDisasterRecoveryConfiguration 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 AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2024-10-01-preview", + params_added_on={ + "2024-10-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "autonomousdatabasename", + "content_type", + "accept", + ] + }, + ) + def begin_change_disaster_recovery_configuration( # pylint: disable=name-too-long + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.DisasterRecoveryConfigurationDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform ChangeDisasterRecoveryConfiguration 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 one of the following types: + DisasterRecoveryConfigurationDetails, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.DisasterRecoveryConfigurationDetails or JSON or + IO[bytes] + :return: An instance of LROPoller that returns AutonomousDatabase. The AutonomousDatabase is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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._change_disaster_recovery_configuration_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AutonomousDatabase, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_or_update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: Union[_models.AutonomousDatabaseBackup, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_database_backups_create_or_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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, JSON, 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 one of the following types: + AutonomousDatabaseBackup, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup or JSON or IO[bytes] + :return: An instance of LROPoller that returns AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AutonomousDatabaseBackup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @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. The AutonomousDatabaseBackup is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + + _request = build_autonomous_database_backups_get_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabaseBackup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_autonomous_database_backups_delete_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: Union[_models.AutonomousDatabaseBackup, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_autonomous_database_backups_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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.AutonomousDatabaseBackup, + *, + 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.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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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 AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :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.AutonomousDatabaseBackup, JSON, 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 one of the following types: + AutonomousDatabaseBackup, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup or JSON or + IO[bytes] + :return: An instance of LROPoller that returns AutonomousDatabaseBackup. The + AutonomousDatabaseBackup is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AutonomousDatabaseBackup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace + def list_by_parent( + 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 AutonomousDatabaseBackup + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabaseBackup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_database_backups_list_by_parent_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDatabaseBackup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The AutonomousDatabaseCharacterSet is compatible with + MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDatabaseCharacterSet] = kwargs.pop("cls", None) + + _request = build_autonomous_database_character_sets_get_request( + location=location, + adbscharsetname=adbscharsetname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabaseCharacterSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.AutonomousDatabaseCharacterSet"]: + """List AutonomousDatabaseCharacterSet resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of AutonomousDatabaseCharacterSet + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabaseCharacterSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_database_character_sets_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDatabaseCharacterSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The AutonomousDatabaseNationalCharacterSet is + compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDatabaseNationalCharacterSet] = kwargs.pop("cls", None) + + _request = build_autonomous_database_national_character_sets_get_request( + location=location, + adbsncharsetname=adbsncharsetname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDatabaseNationalCharacterSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location( + self, location: str, **kwargs: Any + ) -> Iterable["_models.AutonomousDatabaseNationalCharacterSet"]: + """List AutonomousDatabaseNationalCharacterSet resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of AutonomousDatabaseNationalCharacterSet + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDatabaseNationalCharacterSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_database_national_character_sets_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AutonomousDatabaseNationalCharacterSet], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The AutonomousDbVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDbVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutonomousDbVersion] = kwargs.pop("cls", None) + + _request = build_autonomous_database_versions_get_request( + location=location, + autonomousdbversionsname=autonomousdbversionsname, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutonomousDbVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.AutonomousDbVersion"]: + """List AutonomousDbVersion resources by SubscriptionLocationResource. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of AutonomousDbVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDbVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutonomousDbVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_autonomous_database_versions_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AutonomousDbVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ExadbVmClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`exadb_vm_clusters` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "accept"]}, + ) + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ExadbVmCluster"]: + """List ExadbVmCluster resources by subscription ID. + + :return: An iterator like instance of ExadbVmCluster + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExadbVmCluster]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exadb_vm_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExadbVmCluster], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + def _create_or_update_initial( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + resource: Union[_models.ExadbVmCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exadb_vm_clusters_create_or_update_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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, + exadb_vm_cluster_name: str, + resource: _models.ExadbVmCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """Create a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.ExadbVmCluster + :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 ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """Create a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """Create a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: 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 ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + def begin_create_or_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + resource: Union[_models.ExadbVmCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """Create a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param resource: Resource create parameters. Is one of the following types: ExadbVmCluster, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.ExadbVmCluster or JSON or IO[bytes] + :return: An instance of LROPoller that returns ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExadbVmCluster] = 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, + exadb_vm_cluster_name=exadb_vm_cluster_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ExadbVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ExadbVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ExadbVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "accept", + ] + }, + ) + def get(self, resource_group_name: str, exadb_vm_cluster_name: str, **kwargs: Any) -> _models.ExadbVmCluster: + """Get a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :return: ExadbVmCluster. The ExadbVmCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.ExadbVmCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ExadbVmCluster] = kwargs.pop("cls", None) + + _request = build_exadb_vm_clusters_get_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ExadbVmCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + def _update_initial( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + properties: Union[_models.ExadbVmClusterUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exadb_vm_clusters_update_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + properties: _models.ExadbVmClusterUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """Update a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.ExadbVmClusterUpdate + :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 ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """Update a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :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 ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """Update a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: 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 ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + def begin_update( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + properties: Union[_models.ExadbVmClusterUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """Update a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param properties: The resource properties to be updated. Is one of the following types: + ExadbVmClusterUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.ExadbVmClusterUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExadbVmCluster] = 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, + exadb_vm_cluster_name=exadb_vm_cluster_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ExadbVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ExadbVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ExadbVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "accept", + ] + }, + ) + def _delete_initial(self, resource_group_name: str, exadb_vm_cluster_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_exadb_vm_clusters_delete_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "accept", + ] + }, + ) + def begin_delete(self, resource_group_name: str, exadb_vm_cluster_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "resource_group_name", "accept"]}, + ) + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ExadbVmCluster"]: + """List ExadbVmCluster 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 ExadbVmCluster + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExadbVmCluster]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exadb_vm_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExadbVmCluster], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + def _remove_vms_initial( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + body: Union[_models.RemoveVirtualMachineFromExadbVmClusterDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exadb_vm_clusters_remove_vms_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + 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, + exadb_vm_cluster_name: str, + body: _models.RemoveVirtualMachineFromExadbVmClusterDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.RemoveVirtualMachineFromExadbVmClusterDetails + :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 ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_remove_vms( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param body: The content of the action request. Required. + :type body: JSON + :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 ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_remove_vms( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: 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 ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "content_type", + "accept", + ] + }, + ) + def begin_remove_vms( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + body: Union[_models.RemoveVirtualMachineFromExadbVmClusterDetails, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ExadbVmCluster]: + """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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param body: The content of the action request. Is one of the following types: + RemoveVirtualMachineFromExadbVmClusterDetails, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.RemoveVirtualMachineFromExadbVmClusterDetails or + JSON or IO[bytes] + :return: An instance of LROPoller that returns ExadbVmCluster. The ExadbVmCluster is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExadbVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExadbVmCluster] = 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, + exadb_vm_cluster_name=exadb_vm_cluster_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ExadbVmCluster, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ExadbVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ExadbVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class ExascaleDbNodesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`exascale_db_nodes` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "exascale_db_node_name", + "accept", + ] + }, + ) + def get( + self, resource_group_name: str, exadb_vm_cluster_name: str, exascale_db_node_name: str, **kwargs: Any + ) -> _models.ExascaleDbNode: + """Get a ExascaleDbNode. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: str + :return: ExascaleDbNode. The ExascaleDbNode is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.ExascaleDbNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ExascaleDbNode] = kwargs.pop("cls", None) + + _request = build_exascale_db_nodes_get_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + exascale_db_node_name=exascale_db_node_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ExascaleDbNode, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "accept", + ] + }, + ) + def list_by_parent( + self, resource_group_name: str, exadb_vm_cluster_name: str, **kwargs: Any + ) -> Iterable["_models.ExascaleDbNode"]: + """List ExascaleDbNode resources by ExadbVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :return: An iterator like instance of ExascaleDbNode + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.ExascaleDbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExascaleDbNode]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exascale_db_nodes_list_by_parent_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExascaleDbNode], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "exascale_db_node_name", + "content_type", + "accept", + ] + }, + ) + def _action_initial( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: Union[_models.DbNodeAction, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exascale_db_nodes_action_request( + resource_group_name=resource_group_name, + exadb_vm_cluster_name=exadb_vm_cluster_name, + exascale_db_node_name=exascale_db_node_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_action( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: _models.DbNodeAction, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DbActionResponse]: + """VM actions on DbNode of ExadbVmCluster 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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: 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 DbActionResponse. The DbActionResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.DbActionResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_action( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DbActionResponse]: + """VM actions on DbNode of ExadbVmCluster 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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: str + :param body: The content of the action request. Required. + :type body: JSON + :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 DbActionResponse. The DbActionResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.DbActionResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_action( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DbActionResponse]: + """VM actions on DbNode of ExadbVmCluster 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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: 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 DbActionResponse. The DbActionResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.DbActionResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exadb_vm_cluster_name", + "exascale_db_node_name", + "content_type", + "accept", + ] + }, + ) + def begin_action( + self, + resource_group_name: str, + exadb_vm_cluster_name: str, + exascale_db_node_name: str, + body: Union[_models.DbNodeAction, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DbActionResponse]: + """VM actions on DbNode of ExadbVmCluster 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 exadb_vm_cluster_name: The name of the ExadbVmCluster. Required. + :type exadb_vm_cluster_name: str + :param exascale_db_node_name: The name of the ExascaleDbNode. Required. + :type exascale_db_node_name: str + :param body: The content of the action request. Is one of the following types: DbNodeAction, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.oracledatabase.models.DbNodeAction or JSON or IO[bytes] + :return: An instance of LROPoller that returns DbActionResponse. The DbActionResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.DbActionResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DbActionResponse] = 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, + exadb_vm_cluster_name=exadb_vm_cluster_name, + exascale_db_node_name=exascale_db_node_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.DbActionResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DbActionResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DbActionResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class ExascaleDbStorageVaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`exascale_db_storage_vaults` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: OracleDatabaseMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "accept", + ] + }, + ) + def get( + self, resource_group_name: str, exascale_db_storage_vault_name: str, **kwargs: Any + ) -> _models.ExascaleDbStorageVault: + """Get a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :return: ExascaleDbStorageVault. The ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ExascaleDbStorageVault] = kwargs.pop("cls", None) + + _request = build_exascale_db_storage_vaults_get_request( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ExascaleDbStorageVault, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "content_type", + "accept", + ] + }, + ) + def _create_initial( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: Union[_models.ExascaleDbStorageVault, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exascale_db_storage_vaults_create_request( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: _models.ExascaleDbStorageVault, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExascaleDbStorageVault]: + """Create a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault + :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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExascaleDbStorageVault]: + """Create a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExascaleDbStorageVault]: + """Create a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: 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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "content_type", + "accept", + ] + }, + ) + def begin_create( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + resource: Union[_models.ExascaleDbStorageVault, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ExascaleDbStorageVault]: + """Create a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param resource: Resource create parameters. Is one of the following types: + ExascaleDbStorageVault, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault or JSON or IO[bytes] + :return: An instance of LROPoller that returns ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExascaleDbStorageVault] = 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_initial( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ExascaleDbStorageVault, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ExascaleDbStorageVault].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ExascaleDbStorageVault]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "content_type", + "accept", + ] + }, + ) + def _update_initial( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + properties: Union[_models.ExascaleDbStorageVaultTagsUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_exascale_db_storage_vaults_update_request( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + properties: _models.ExascaleDbStorageVaultTagsUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExascaleDbStorageVault]: + """Update a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVaultTagsUpdate + :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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExascaleDbStorageVault]: + """Update a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExascaleDbStorageVault]: + """Update a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: 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 ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "content_type", + "accept", + ] + }, + ) + def begin_update( + self, + resource_group_name: str, + exascale_db_storage_vault_name: str, + properties: Union[_models.ExascaleDbStorageVaultTagsUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ExascaleDbStorageVault]: + """Update a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :param properties: The resource properties to be updated. Is one of the following types: + ExascaleDbStorageVaultTagsUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.oracledatabase.models.ExascaleDbStorageVaultTagsUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ExascaleDbStorageVault. The + ExascaleDbStorageVault is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExascaleDbStorageVault] = 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, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ExascaleDbStorageVault, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ExascaleDbStorageVault].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ExascaleDbStorageVault]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "accept", + ] + }, + ) + def _delete_initial( + self, resource_group_name: str, exascale_db_storage_vault_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_exascale_db_storage_vaults_delete_request( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "exascale_db_storage_vault_name", + "accept", + ] + }, + ) + def begin_delete( + self, resource_group_name: str, exascale_db_storage_vault_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a ExascaleDbStorageVault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param exascale_db_storage_vault_name: The name of the ExascaleDbStorageVault. Required. + :type exascale_db_storage_vault_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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( + resource_group_name=resource_group_name, + exascale_db_storage_vault_name=exascale_db_storage_vault_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "resource_group_name", "accept"]}, + ) + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ExascaleDbStorageVault"]: + """List ExascaleDbStorageVault 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 ExascaleDbStorageVault + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExascaleDbStorageVault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exascale_db_storage_vaults_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExascaleDbStorageVault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "subscription_id", "accept"]}, + ) + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ExascaleDbStorageVault"]: + """List ExascaleDbStorageVault resources by subscription ID. + + :return: An iterator like instance of ExascaleDbStorageVault + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.ExascaleDbStorageVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExascaleDbStorageVault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_exascale_db_storage_vaults_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ExascaleDbStorageVault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/oracledatabase/arm-oracledatabase/operations/_patch.py b/sdk/oracledatabase/arm-oracledatabase/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/oracledatabase/arm-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/oracledatabase/arm-oracledatabase/py.typed b/sdk/oracledatabase/arm-oracledatabase/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/oracledatabase/arm-oracledatabase/setup.py b/sdk/oracledatabase/arm-oracledatabase/setup.py new file mode 100644 index 000000000000..849246528de4 --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/setup.py @@ -0,0 +1,71 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# coding: utf-8 + +import os +import re +from setuptools import setup, find_packages + + +PACKAGE_NAME = "azure-mgmt-oracledatabase" +PACKAGE_PPRINT_NAME = "Azure Mgmt Oracledatabase" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") + +# Version extraction inspired from 'requests' +with open(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") + + +setup( + name=PACKAGE_NAME, + version=version, + description="Microsoft {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=open("README.md", "r").read(), + 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/tree/main/sdk", + keywords="azure, azure sdk", + 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={ + "azure.mgmt.oracledatabase": ["py.typed"], + }, + install_requires=[ + "isodate>=0.6.1", + "azure-mgmt-core>=1.3.2", + "typing-extensions>=4.6.0", + ], + python_requires=">=3.8", +) diff --git a/sdk/oracledatabase/arm-oracledatabase/tsp-location.yaml b/sdk/oracledatabase/arm-oracledatabase/tsp-location.yaml new file mode 100644 index 000000000000..3c7da6a0652f --- /dev/null +++ b/sdk/oracledatabase/arm-oracledatabase/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/oracle/Oracle.Database.Management +commit: c23c4573fbb6a7d316cc664470309a2eea39c63e +repo: Azure/azure-rest-api-specs +additionalDirectories: