From 7b4ec1f71917efd1e7660f8597e9714150f0de46 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 8 May 2025 04:14:34 +0000 Subject: [PATCH] CodeGen from PR 34522 in Azure/azure-rest-api-specs Merge 0b88b56b7e0bfbd7c8ed2b1efdb5cacb5ed0257a into 121c5e84647a9cdb1767d5146affdfe2af91d776 --- .../CHANGELOG.md | 573 ++ .../README.md | 9 +- .../_meta.json | 11 +- .../apiview-properties.json | 243 + .../__init__.py | 14 +- .../_client.py | 223 + .../_configuration.py | 32 +- .../recoveryservicesdatareplication/_patch.py | 9 +- ...y_services_data_replication_mgmt_client.py | 194 - .../_utils/__init__.py | 6 + .../_utils/model_base.py | 1232 +++ .../serialization.py} | 648 +- .../_vendor.py | 36 - .../_version.py | 4 +- .../aio/__init__.py | 14 +- ..._replication_mgmt_client.py => _client.py} | 207 +- .../aio/_configuration.py | 32 +- .../aio/_patch.py | 9 +- .../aio/_vendor.py | 28 - .../aio/operations/__init__.py | 76 +- .../_dra_operation_status_operations.py | 125 - .../aio/operations/_dra_operations.py | 606 -- .../_email_configuration_operations.py | 388 - .../aio/operations/_event_operations.py | 231 - .../aio/operations/_fabric_operations.py | 926 -- .../_fabric_operations_status_operations.py | 122 - .../aio/operations/_operations.py | 7499 +++++++++++++- .../aio/operations/_patch.py | 9 +- .../_policy_operation_status_operations.py | 125 - .../aio/operations/_policy_operations.py | 606 -- ...tected_item_operation_status_operations.py | 125 - .../operations/_protected_item_operations.py | 882 -- .../operations/_recovery_points_operations.py | 231 - ...data_replication_mgmt_client_operations.py | 321 - ...n_extension_operation_status_operations.py | 130 - .../_replication_extension_operations.py | 610 -- .../_vault_operation_status_operations.py | 122 - .../aio/operations/_vault_operations.py | 925 -- .../_workflow_operation_status_operations.py | 125 - .../aio/operations/_workflow_operations.py | 231 - .../models/__init__.py | 359 +- .../models/_enums.py | 376 + .../models/_models.py | 5926 +++++++++++ .../models/_models_py3.py | 6411 ------------ .../models/_patch.py | 9 +- ...ices_data_replication_mgmt_client_enums.py | 202 - .../operations/__init__.py | 76 +- .../_dra_operation_status_operations.py | 167 - .../operations/_dra_operations.py | 735 -- .../_email_configuration_operations.py | 495 - .../operations/_event_operations.py | 309 - .../operations/_fabric_operations.py | 1124 -- .../_fabric_operations_status_operations.py | 158 - .../operations/_operations.py | 9139 ++++++++++++++++- .../operations/_patch.py | 9 +- .../_policy_operation_status_operations.py | 162 - .../operations/_policy_operations.py | 736 -- ...tected_item_operation_status_operations.py | 169 - .../operations/_protected_item_operations.py | 1064 -- .../operations/_recovery_points_operations.py | 312 - ...data_replication_mgmt_client_operations.py | 387 - ...n_extension_operation_status_operations.py | 174 - .../_replication_extension_operations.py | 748 -- .../_vault_operation_status_operations.py | 158 - .../operations/_vault_operations.py | 1111 -- .../_workflow_operation_status_operations.py | 162 - .../operations/_workflow_operations.py | 309 - ...ity.py => check_name_availability_post.py} | 11 +- .../generated_samples/deployment_preflight.py | 41 - .../deployment_preflight_post.py | 42 + .../generated_samples/dra_create.py | 42 - .../dra_operation_status_get.py | 43 - .../email_configuration_create.py | 42 - .../email_configuration_get.py | 9 +- .../email_configuration_list.py | 9 +- .../generated_samples/event_get.py | 9 +- .../generated_samples/event_list.py | 9 +- .../{dra_delete.py => fabric_agent_delete.py} | 13 +- .../{dra_get.py => fabric_agent_get.py} | 11 +- .../{dra_list.py => fabric_agent_list.py} | 13 +- .../generated_samples/fabric_create.py | 41 - .../generated_samples/fabric_delete.py | 7 +- .../generated_samples/fabric_get.py | 7 +- .../generated_samples/fabric_list.py | 9 +- .../fabric_list_by_subscription.py | 7 +- .../fabric_operations_status_get.py | 42 - .../generated_samples/fabric_update.py | 41 - .../{workflow_get.py => job_get.py} | 11 +- .../{workflow_list.py => job_list.py} | 11 +- .../location_based_operation_results_get.py | 43 + .../operation_results_get.py | 42 + .../generated_samples/operations_list.py | 5 +- .../generated_samples/policy_create.py | 42 - .../generated_samples/policy_delete.py | 7 +- .../generated_samples/policy_get.py | 7 +- .../generated_samples/policy_list.py | 7 +- .../policy_operation_status_get.py | 43 - .../private_endpoint_connection_delete.py | 42 + ....py => private_endpoint_connection_get.py} | 16 +- .../private_endpoint_connection_list.py | 43 + ...rivate_endpoint_connection_proxy_delete.py | 42 + ... private_endpoint_connection_proxy_get.py} | 16 +- .../private_endpoint_connection_proxy_list.py | 43 + ...vate_endpoint_connection_proxy_validate.py | 95 + .../private_link_resource_get.py | 43 + .../private_link_resource_list.py | 43 + .../protected_item_create.py | 42 - .../protected_item_delete.py | 7 +- .../generated_samples/protected_item_get.py | 7 +- .../generated_samples/protected_item_list.py | 7 +- .../protected_item_operation_status_get.py | 43 - .../protected_item_planned_failover.py | 8 +- .../generated_samples/recovery_points_get.py | 9 +- .../generated_samples/recovery_points_list.py | 9 +- .../replication_extension_create.py | 42 - .../replication_extension_delete.py | 7 +- .../replication_extension_get.py | 7 +- .../replication_extension_list.py | 7 +- ...lication_extension_operation_status_get.py | 43 - .../generated_samples/vault_delete.py | 7 +- .../generated_samples/vault_get.py | 7 +- .../generated_samples/vault_list.py | 7 +- .../vault_list_by_subscription.py | 7 +- .../vault_operation_status_get.py | 42 - .../workflow_operation_status_get.py | 43 - .../generated_tests/conftest.py | 51 + ...mgmt_check_name_availability_operations.py | 29 + ...heck_name_availability_operations_async.py | 30 + ...on_mgmt_deployment_preflight_operations.py | 30 + ...t_deployment_preflight_operations_async.py | 31 + ...ion_mgmt_email_configuration_operations.py | 73 + ...mt_email_configuration_operations_async.py | 74 + ..._data_replication_mgmt_event_operations.py | 42 + ...replication_mgmt_event_operations_async.py | 43 + ...eplication_mgmt_fabric_agent_operations.py | 135 + ...tion_mgmt_fabric_agent_operations_async.py | 140 + ...data_replication_mgmt_fabric_operations.py | 188 + ...eplication_mgmt_fabric_operations_async.py | 195 + ...es_data_replication_mgmt_job_operations.py | 42 + ...a_replication_mgmt_job_operations_async.py | 43 + ...tion_based_operation_results_operations.py | 31 + ...ased_operation_results_operations_async.py | 32 + ...ation_mgmt_operation_results_operations.py | 30 + ...mgmt_operation_results_operations_async.py | 31 + ...rvices_data_replication_mgmt_operations.py | 27 + ..._data_replication_mgmt_operations_async.py | 28 + ...data_replication_mgmt_policy_operations.py | 80 + ...eplication_mgmt_policy_operations_async.py | 85 + ..._endpoint_connection_proxies_operations.py | 190 + ...int_connection_proxies_operations_async.py | 193 + ...private_endpoint_connections_operations.py | 88 + ...e_endpoint_connections_operations_async.py | 91 + ..._mgmt_private_link_resources_operations.py | 42 + ...private_link_resources_operations_async.py | 43 + ...lication_mgmt_protected_item_operations.py | 212 + ...on_mgmt_protected_item_operations_async.py | 221 + ...lication_mgmt_recovery_point_operations.py | 44 + ...on_mgmt_recovery_point_operations_async.py | 45 + ...n_mgmt_replication_extension_operations.py | 83 + ..._replication_extension_operations_async.py | 88 + ..._data_replication_mgmt_vault_operations.py | 119 + ...replication_mgmt_vault_operations_async.py | 126 + .../sdk_packaging.toml | 2 +- .../setup.py | 15 +- .../tsp-location.yaml | 4 + 165 files changed, 29671 insertions(+), 23751 deletions(-) create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/apiview-properties.json create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_client.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_recovery_services_data_replication_mgmt_client.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/__init__.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/model_base.py rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/{_serialization.py => _utils/serialization.py} (80%) delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_vendor.py rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/{_recovery_services_data_replication_mgmt_client.py => _client.py} (50%) delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_vendor.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_dra_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_dra_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_email_configuration_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_event_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_fabric_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_fabric_operations_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_policy_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_policy_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_protected_item_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_protected_item_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_recovery_points_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_recovery_services_data_replication_mgmt_client_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_replication_extension_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_replication_extension_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_vault_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_vault_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_workflow_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_workflow_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_enums.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_models.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_models_py3.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_recovery_services_data_replication_mgmt_client_enums.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_dra_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_dra_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_email_configuration_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_event_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_fabric_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_fabric_operations_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_policy_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_policy_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_protected_item_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_protected_item_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_recovery_points_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_recovery_services_data_replication_mgmt_client_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_replication_extension_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_replication_extension_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_vault_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_vault_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_workflow_operation_status_operations.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_workflow_operations.py rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/{check_name_availability.py => check_name_availability_post.py} (76%) delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/deployment_preflight.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/deployment_preflight_post.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_create.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_operation_status_get.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_create.py rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/{dra_delete.py => fabric_agent_delete.py} (75%) rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/{dra_get.py => fabric_agent_get.py} (80%) rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/{dra_list.py => fabric_agent_list.py} (76%) delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_create.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_operations_status_get.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_update.py rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/{workflow_get.py => job_get.py} (79%) rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/{workflow_list.py => job_list.py} (79%) create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/location_based_operation_results_get.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/operation_results_get.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_create.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_operation_status_get.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_delete.py rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/{vault_update.py => private_endpoint_connection_get.py} (74%) create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_list.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_delete.py rename sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/{vault_create.py => private_endpoint_connection_proxy_get.py} (74%) create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_list.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_validate.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_link_resource_get.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_link_resource_list.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_create.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_operation_status_get.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_create.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_operation_status_get.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_operation_status_get.py delete mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_operation_status_get.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/conftest.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_check_name_availability_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_check_name_availability_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_deployment_preflight_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_deployment_preflight_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_email_configuration_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_email_configuration_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_event_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_event_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_agent_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_agent_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_job_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_job_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_location_based_operation_results_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_location_based_operation_results_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operation_results_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operation_results_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_policy_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_policy_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connection_proxies_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connection_proxies_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connections_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connections_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_link_resources_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_link_resources_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_protected_item_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_protected_item_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_recovery_point_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_recovery_point_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_replication_extension_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_replication_extension_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_vault_operations.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_vault_operations_async.py create mode 100644 sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/tsp-location.yaml diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/CHANGELOG.md b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/CHANGELOG.md index c118e690a4b6..49f2a1726464 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/CHANGELOG.md +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/CHANGELOG.md @@ -1,5 +1,578 @@ # Release History +## 1.0.0 (2025-05-08) + +### Features Added + + - Client `RecoveryServicesDataReplicationMgmtClient` added method `send_request` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `fabric_agent` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `job` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `private_endpoint_connections` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `private_endpoint_connection_proxies` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `private_link_resources` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `recovery_point` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `check_name_availability` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `deployment_preflight` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `operation_results` + - Client `RecoveryServicesDataReplicationMgmtClient` added operation group `location_based_operation_results` + - Model `DeploymentPreflightResource` added property `properties` + - Model `EmailConfigurationModelProperties` added property `provisioning_state` + - Model `EventModelProperties` added property `provisioning_state` + - Model `HyperVToAzStackHCIDiskInput` added property `disk_block_size` + - Model `HyperVToAzStackHCIDiskInput` added property `disk_logical_sector_size` + - Model `HyperVToAzStackHCIDiskInput` added property `disk_physical_sector_size` + - Model `HyperVToAzStackHCIDiskInput` added property `disk_identifier` + - Model `HyperVToAzStackHCIDiskInput` added property `disk_controller` + - Model `HyperVToAzStackHCINicInput` added property `is_static_ip_migration_enabled` + - Model `HyperVToAzStackHCINicInput` added property `is_mac_migration_enabled` + - Model `HyperVToAzStackHCIProtectedDiskProperties` added property `disk_block_size` + - Model `HyperVToAzStackHCIProtectedDiskProperties` added property `disk_logical_sector_size` + - Model `HyperVToAzStackHCIProtectedDiskProperties` added property `disk_physical_sector_size` + - Model `HyperVToAzStackHCIProtectedItemModelCustomProperties` added property `source_fabric_agent_name` + - Model `HyperVToAzStackHCIProtectedItemModelCustomProperties` added property `target_fabric_agent_name` + - Model `ProtectedItemModelProperties` added property `fabric_agent_id` + - Model `ProtectedItemModelProperties` added property `target_fabric_agent_id` + - Model `RecoveryPointModelProperties` added property `provisioning_state` + - Model `TaskModel` added property `children_jobs` + - Model `VMwareToAzStackHCIDiskInput` added property `disk_block_size` + - Model `VMwareToAzStackHCIDiskInput` added property `disk_logical_sector_size` + - Model `VMwareToAzStackHCIDiskInput` added property `disk_physical_sector_size` + - Model `VMwareToAzStackHCIDiskInput` added property `disk_identifier` + - Model `VMwareToAzStackHCIDiskInput` added property `disk_controller` + - Model `VMwareToAzStackHCINicInput` added property `is_static_ip_migration_enabled` + - Model `VMwareToAzStackHCINicInput` added property `is_mac_migration_enabled` + - Model `VMwareToAzStackHCIProtectedDiskProperties` added property `disk_block_size` + - Model `VMwareToAzStackHCIProtectedDiskProperties` added property `disk_logical_sector_size` + - Model `VMwareToAzStackHCIProtectedDiskProperties` added property `disk_physical_sector_size` + - Model `VMwareToAzStackHCIProtectedItemModelCustomProperties` added property `source_fabric_agent_name` + - Model `VMwareToAzStackHCIProtectedItemModelCustomProperties` added property `target_fabric_agent_name` + - Model `VaultModel` added property `identity` + - Model `VaultModelUpdate` added property `identity` + - Added model `ConnectionDetails` + - Added enum `CreatedByType` + - Added model `DiskControllerInputs` + - Added model `FabricAgentModel` + - Added model `FabricAgentModelCustomProperties` + - Added model `FabricAgentModelProperties` + - Added model `FailoverJobModelCustomProperties` + - Added model `GroupConnectivityInformation` + - Added model `HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate` + - Added model `JobModel` + - Added model `JobModelCustomProperties` + - Added model `JobModelCustomPropertiesAffectedObjectDetails` + - Added model `JobModelProperties` + - Added enum `JobObjectType` + - Added enum `JobState` + - Added model `ManagedServiceIdentity` + - Added enum `ManagedServiceIdentityType` + - Added model `PrivateEndpoint` + - Added model `PrivateEndpointConnection` + - Added model `PrivateEndpointConnectionProxy` + - Added model `PrivateEndpointConnectionProxyProperties` + - Added model `PrivateEndpointConnectionResponseProperties` + - Added enum `PrivateEndpointConnectionStatus` + - Added model `PrivateLinkResource` + - Added model `PrivateLinkResourceProperties` + - Added model `PrivateLinkServiceConnection` + - Added model `PrivateLinkServiceConnectionState` + - Added model `PrivateLinkServiceProxy` + - Added model `ProtectedItemModelCustomPropertiesUpdate` + - Added model `ProtectedItemModelPropertiesUpdate` + - Added model `ProtectedItemModelUpdate` + - Added model `ProxyResource` + - Added model `RemotePrivateEndpoint` + - Added model `RemotePrivateEndpointConnection` + - Added model `Resource` + - Added model `SystemData` + - Added model `TestFailoverCleanupJobModelCustomProperties` + - Added model `TestFailoverJobModelCustomProperties` + - Added model `TrackedResource` + - Added model `UserAssignedIdentity` + - Added model `VMwareFabricAgentModelCustomProperties` + - Added model `VMwareToAzStackHCIEventModelCustomProperties` + - Added model `VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate` + - Added model `VMwareToAzStackHCIRecoveryPointModelCustomProperties` + - Added model `VaultIdentityModel` + - Added enum `VaultIdentityType` + - Model `EventOperations` added parameter `odata_options` in method `list` + - Model `EventOperations` added parameter `page_size` in method `list` + - Model `ProtectedItemOperations` added parameter `odata_options` in method `list` + - Model `ProtectedItemOperations` added parameter `continuation_token_parameter` in method `list` + - Model `ProtectedItemOperations` added parameter `page_size` in method `list` + - Model `ProtectedItemOperations` added method `begin_update` + - Added model `CheckNameAvailabilityOperations` + - Added model `DeploymentPreflightOperations` + - Added model `FabricAgentOperations` + - Added model `JobOperations` + - Added model `LocationBasedOperationResultsOperations` + - Added model `OperationResultsOperations` + - Added model `PrivateEndpointConnectionProxiesOperations` + - Added model `PrivateEndpointConnectionsOperations` + - Added model `PrivateLinkResourcesOperations` + - Added model `RecoveryPointOperations` + - Method `AzStackHCIClusterProperties.__init__` has a new overload `def __init__(self: None, cluster_name: str, resource_name: str, storage_account_name: str, storage_containers: List[_models.StorageContainerProperties])` + - Method `AzStackHCIClusterProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzStackHCIFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, az_stack_hci_site_id: str, cluster: _models.AzStackHCIClusterProperties, migration_solution_id: str)` + - Method `AzStackHCIFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzStackHCIFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `AzStackHCIFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `CheckNameAvailabilityModel.__init__` has a new overload `def __init__(self: None, name: Optional[str], type: Optional[str])` + - Method `CheckNameAvailabilityModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `CheckNameAvailabilityResponseModel.__init__` has a new overload `def __init__(self: None, name_available: Optional[bool], reason: Optional[str], message: Optional[str])` + - Method `CheckNameAvailabilityResponseModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `DeploymentPreflightModel.__init__` has a new overload `def __init__(self: None, resources: Optional[List[_models.DeploymentPreflightResource]])` + - Method `DeploymentPreflightModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `DeploymentPreflightResource.__init__` has a new overload `def __init__(self: None, name: Optional[str], type: Optional[str], location: Optional[str], api_version: Optional[str], properties: Optional[Any])` + - Method `DeploymentPreflightResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `EmailConfigurationModel.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.EmailConfigurationModelProperties])` + - Method `EmailConfigurationModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `EmailConfigurationModelProperties.__init__` has a new overload `def __init__(self: None, send_to_owners: bool, custom_email_addresses: Optional[List[str]], locale: Optional[str])` + - Method `EmailConfigurationModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ErrorResponse.__init__` has a new overload `def __init__(self: None, error: Optional[_models.ErrorDetail])` + - Method `ErrorResponse.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `EventModel.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.EventModelProperties])` + - Method `EventModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `EventModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `EventModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `EventModelProperties.__init__` has a new overload `def __init__(self: None, custom_properties: _models.EventModelCustomProperties)` + - Method `EventModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FabricModel.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]], properties: Optional[_models.FabricModelProperties])` + - Method `FabricModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FabricModel.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]])` + - Method `FabricModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `FabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FabricModelProperties.__init__` has a new overload `def __init__(self: None, custom_properties: _models.FabricModelCustomProperties)` + - Method `FabricModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FabricModelUpdate.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]], properties: Optional[_models.FabricModelProperties])` + - Method `FabricModelUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HealthErrorModel.__init__` has a new overload `def __init__(self: None, affected_resource_type: Optional[str], affected_resource_correlation_ids: Optional[List[str]], child_errors: Optional[List[_models.InnerHealthErrorModel]])` + - Method `HealthErrorModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVMigrateFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, hyper_v_site_id: str, migration_solution_id: str)` + - Method `HyperVMigrateFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVMigrateFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `HyperVMigrateFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIDiskInput.__init__` has a new overload `def __init__(self: None, disk_id: str, disk_size_gb: int, disk_file_format: str, is_os_disk: bool, storage_container_id: Optional[str], is_dynamic: Optional[bool], disk_block_size: Optional[int], disk_logical_sector_size: Optional[int], disk_physical_sector_size: Optional[int], disk_identifier: Optional[str], disk_controller: Optional[_models.DiskControllerInputs])` + - Method `HyperVToAzStackHCIDiskInput.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIEventModelCustomProperties.__init__` has a new overload `def __init__(self: None)` + - Method `HyperVToAzStackHCIEventModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIEventModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `HyperVToAzStackHCIEventModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCINicInput.__init__` has a new overload `def __init__(self: None, nic_id: str, selection_type_for_failover: Union[str, _models.VMNicSelection], target_network_id: Optional[str], test_network_id: Optional[str], is_static_ip_migration_enabled: Optional[bool], is_mac_migration_enabled: Optional[bool])` + - Method `HyperVToAzStackHCINicInput.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIPlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, shutdown_source_vm: bool)` + - Method `HyperVToAzStackHCIPlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIPlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `HyperVToAzStackHCIPlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIPolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, recovery_point_history_in_minutes: int, crash_consistent_frequency_in_minutes: int, app_consistent_frequency_in_minutes: int)` + - Method `HyperVToAzStackHCIPolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIPolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `HyperVToAzStackHCIPolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, target_hci_cluster_id: str, target_arc_cluster_custom_location_id: str, fabric_discovery_machine_id: str, disks_to_include: List[_models.HyperVToAzStackHCIDiskInput], nics_to_include: List[_models.HyperVToAzStackHCINicInput], target_resource_group_id: str, storage_container_id: str, hyper_v_generation: str, run_as_account_id: str, source_fabric_agent_name: str, target_fabric_agent_name: str, custom_location_region: str, target_vm_name: Optional[str], target_network_id: Optional[str], test_network_id: Optional[str], target_cpu_cores: Optional[int], is_dynamic_ram: Optional[bool], dynamic_memory_config: Optional[_models.ProtectedItemDynamicMemoryConfig], target_memory_in_mega_bytes: Optional[int])` + - Method `HyperVToAzStackHCIProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `HyperVToAzStackHCIProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIRecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None)` + - Method `HyperVToAzStackHCIRecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIRecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `HyperVToAzStackHCIRecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, hyper_v_fabric_arm_id: str, az_stack_hci_fabric_arm_id: str, storage_account_id: Optional[str], storage_account_sas_secret_name: Optional[str])` + - Method `HyperVToAzStackHCIReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `HyperVToAzStackHCIReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `IdentityModel.__init__` has a new overload `def __init__(self: None, tenant_id: str, application_id: str, object_id: str, audience: str, aad_authority: str)` + - Method `IdentityModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Operation.__init__` has a new overload `def __init__(self: None, display: Optional[_models.OperationDisplay])` + - Method `Operation.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `OperationStatus.__init__` has a new overload `def __init__(self: None, id: Optional[str], name: Optional[str], status: Optional[str], start_time: Optional[str], end_time: Optional[str])` + - Method `OperationStatus.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PlannedFailoverModel.__init__` has a new overload `def __init__(self: None, properties: _models.PlannedFailoverModelProperties)` + - Method `PlannedFailoverModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `PlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PlannedFailoverModelProperties.__init__` has a new overload `def __init__(self: None, custom_properties: _models.PlannedFailoverModelCustomProperties)` + - Method `PlannedFailoverModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PolicyModel.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.PolicyModelProperties])` + - Method `PolicyModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `PolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PolicyModelProperties.__init__` has a new overload `def __init__(self: None, custom_properties: _models.PolicyModelCustomProperties)` + - Method `PolicyModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ProtectedItemDynamicMemoryConfig.__init__` has a new overload `def __init__(self: None, maximum_memory_in_mega_bytes: int, minimum_memory_in_mega_bytes: int, target_memory_buffer_percentage: int)` + - Method `ProtectedItemDynamicMemoryConfig.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ProtectedItemModel.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.ProtectedItemModelProperties])` + - Method `ProtectedItemModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `ProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ProtectedItemModelProperties.__init__` has a new overload `def __init__(self: None, policy_name: str, replication_extension_name: str, custom_properties: _models.ProtectedItemModelCustomProperties)` + - Method `ProtectedItemModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `RecoveryPointModel.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.RecoveryPointModelProperties])` + - Method `RecoveryPointModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `RecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `RecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `RecoveryPointModelProperties.__init__` has a new overload `def __init__(self: None, recovery_point_time: datetime, recovery_point_type: Union[str, _models.RecoveryPointType], custom_properties: _models.RecoveryPointModelCustomProperties)` + - Method `RecoveryPointModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ReplicationExtensionModel.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.ReplicationExtensionModelProperties])` + - Method `ReplicationExtensionModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `ReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ReplicationExtensionModelProperties.__init__` has a new overload `def __init__(self: None, custom_properties: _models.ReplicationExtensionModelCustomProperties)` + - Method `ReplicationExtensionModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `StorageContainerProperties.__init__` has a new overload `def __init__(self: None, name: str, cluster_shared_volume_path: str)` + - Method `StorageContainerProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TaskModel.__init__` has a new overload `def __init__(self: None, custom_properties: Optional[_models.TaskModelCustomProperties], children_jobs: Optional[List[_models.JobModel]])` + - Method `TaskModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TaskModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `TaskModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareMigrateFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, vmware_site_id: str, migration_solution_id: str)` + - Method `VMwareMigrateFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareMigrateFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `VMwareMigrateFabricModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIDiskInput.__init__` has a new overload `def __init__(self: None, disk_id: str, disk_size_gb: int, disk_file_format: str, is_os_disk: bool, storage_container_id: Optional[str], is_dynamic: Optional[bool], disk_block_size: Optional[int], disk_logical_sector_size: Optional[int], disk_physical_sector_size: Optional[int], disk_identifier: Optional[str], disk_controller: Optional[_models.DiskControllerInputs])` + - Method `VMwareToAzStackHCIDiskInput.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCINicInput.__init__` has a new overload `def __init__(self: None, nic_id: str, label: str, selection_type_for_failover: Union[str, _models.VMNicSelection], target_network_id: Optional[str], test_network_id: Optional[str], is_static_ip_migration_enabled: Optional[bool], is_mac_migration_enabled: Optional[bool])` + - Method `VMwareToAzStackHCINicInput.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIPlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, shutdown_source_vm: bool)` + - Method `VMwareToAzStackHCIPlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIPlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `VMwareToAzStackHCIPlannedFailoverModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIPolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, recovery_point_history_in_minutes: int, crash_consistent_frequency_in_minutes: int, app_consistent_frequency_in_minutes: int)` + - Method `VMwareToAzStackHCIPolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIPolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `VMwareToAzStackHCIPolicyModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, target_hci_cluster_id: str, target_arc_cluster_custom_location_id: str, storage_container_id: str, target_resource_group_id: str, custom_location_region: str, disks_to_include: List[_models.VMwareToAzStackHCIDiskInput], nics_to_include: List[_models.VMwareToAzStackHCINicInput], hyper_v_generation: str, fabric_discovery_machine_id: str, run_as_account_id: str, source_fabric_agent_name: str, target_fabric_agent_name: str, target_vm_name: Optional[str], target_network_id: Optional[str], test_network_id: Optional[str], target_cpu_cores: Optional[int], is_dynamic_ram: Optional[bool], dynamic_memory_config: Optional[_models.ProtectedItemDynamicMemoryConfig], target_memory_in_mega_bytes: Optional[int], perform_auto_resync: Optional[bool])` + - Method `VMwareToAzStackHCIProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `VMwareToAzStackHCIProtectedItemModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIProtectedNicProperties.__init__` has a new overload `def __init__(self: None, is_primary_nic: Optional[bool])` + - Method `VMwareToAzStackHCIProtectedNicProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, vmware_fabric_arm_id: str, az_stack_hci_fabric_arm_id: str, storage_account_id: Optional[str], storage_account_sas_secret_name: Optional[str])` + - Method `VMwareToAzStackHCIReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `VMwareToAzStackHCIReplicationExtensionModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VaultModel.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]], properties: Optional[_models.VaultModelProperties], identity: Optional[_models.ManagedServiceIdentity])` + - Method `VaultModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VaultModel.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]])` + - Method `VaultModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VaultModelProperties.__init__` has a new overload `def __init__(self: None, vault_type: Optional[Union[str, _models.ReplicationVaultType]])` + - Method `VaultModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VaultModelUpdate.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]], properties: Optional[_models.VaultModelProperties], identity: Optional[_models.VaultIdentityModel])` + - Method `VaultModelUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ConnectionDetails.__init__` has a new overload `def __init__(self: None, id: Optional[str], private_ip_address: Optional[str], link_identifier: Optional[str], group_id: Optional[str], member_name: Optional[str])` + - Method `ConnectionDetails.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `DiskControllerInputs.__init__` has a new overload `def __init__(self: None, controller_name: str, controller_id: int, controller_location: int)` + - Method `DiskControllerInputs.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FabricAgentModel.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.FabricAgentModelProperties])` + - Method `FabricAgentModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FabricAgentModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `FabricAgentModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FabricAgentModelProperties.__init__` has a new overload `def __init__(self: None, machine_id: str, machine_name: str, authentication_identity: _models.IdentityModel, resource_access_identity: _models.IdentityModel, custom_properties: _models.FabricAgentModelCustomProperties)` + - Method `FabricAgentModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FailoverJobModelCustomProperties.__init__` has a new overload `def __init__(self: None)` + - Method `FailoverJobModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FailoverJobModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `FailoverJobModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `GroupConnectivityInformation.__init__` has a new overload `def __init__(self: None, group_id: Optional[str], member_name: Optional[str], customer_visible_fqdns: Optional[List[str]], internal_fqdn: Optional[str], redirect_map_id: Optional[str], private_link_service_arm_region: Optional[str])` + - Method `GroupConnectivityInformation.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, nics_to_include: Optional[List[_models.HyperVToAzStackHCINicInput]], target_cpu_cores: Optional[int], is_dynamic_ram: Optional[bool], dynamic_memory_config: Optional[_models.ProtectedItemDynamicMemoryConfig], target_memory_in_mega_bytes: Optional[int], os_type: Optional[str])` + - Method `HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `JobModel.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.JobModelProperties])` + - Method `JobModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `JobModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `JobModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `JobModelCustomPropertiesAffectedObjectDetails.__init__` has a new overload `def __init__(self: None, description: Optional[str], type: Optional[Literal[object]])` + - Method `JobModelCustomPropertiesAffectedObjectDetails.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `JobModelProperties.__init__` has a new overload `def __init__(self: None, custom_properties: _models.JobModelCustomProperties)` + - Method `JobModelProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ManagedServiceIdentity.__init__` has a new overload `def __init__(self: None, type: Union[str, _models.ManagedServiceIdentityType], user_assigned_identities: Optional[Dict[str, _models.UserAssignedIdentity]])` + - Method `ManagedServiceIdentity.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateEndpoint.__init__` has a new overload `def __init__(self: None, id: Optional[str])` + - Method `PrivateEndpoint.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateEndpointConnection.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.PrivateEndpointConnectionResponseProperties])` + - Method `PrivateEndpointConnection.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateEndpointConnectionProxy.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.PrivateEndpointConnectionProxyProperties], etag: Optional[str])` + - Method `PrivateEndpointConnectionProxy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateEndpointConnectionProxyProperties.__init__` has a new overload `def __init__(self: None, remote_private_endpoint: Optional[_models.RemotePrivateEndpoint])` + - Method `PrivateEndpointConnectionProxyProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateEndpointConnectionResponseProperties.__init__` has a new overload `def __init__(self: None, private_endpoint: Optional[_models.PrivateEndpoint], private_link_service_connection_state: Optional[_models.PrivateLinkServiceConnectionState])` + - Method `PrivateEndpointConnectionResponseProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateLinkResource.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.PrivateLinkResourceProperties])` + - Method `PrivateLinkResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateLinkResourceProperties.__init__` has a new overload `def __init__(self: None, group_id: Optional[str], required_members: Optional[List[str]], required_zone_names: Optional[List[str]])` + - Method `PrivateLinkResourceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateLinkServiceConnection.__init__` has a new overload `def __init__(self: None, name: Optional[str], group_ids: Optional[List[str]], request_message: Optional[str])` + - Method `PrivateLinkServiceConnection.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateLinkServiceConnectionState.__init__` has a new overload `def __init__(self: None, status: Optional[Union[str, _models.PrivateEndpointConnectionStatus]], description: Optional[str], actions_required: Optional[str])` + - Method `PrivateLinkServiceConnectionState.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateLinkServiceProxy.__init__` has a new overload `def __init__(self: None, id: Optional[str], remote_private_link_service_connection_state: Optional[_models.PrivateLinkServiceConnectionState], remote_private_endpoint_connection: Optional[_models.RemotePrivateEndpointConnection], group_connectivity_information: Optional[List[_models.GroupConnectivityInformation]])` + - Method `PrivateLinkServiceProxy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `ProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ProtectedItemModelPropertiesUpdate.__init__` has a new overload `def __init__(self: None, custom_properties: Optional[_models.ProtectedItemModelCustomPropertiesUpdate])` + - Method `ProtectedItemModelPropertiesUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ProtectedItemModelUpdate.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.ProtectedItemModelPropertiesUpdate])` + - Method `ProtectedItemModelUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `RemotePrivateEndpoint.__init__` has a new overload `def __init__(self: None, id: str, private_link_service_connections: Optional[List[_models.PrivateLinkServiceConnection]], manual_private_link_service_connections: Optional[List[_models.PrivateLinkServiceConnection]], private_link_service_proxies: Optional[List[_models.PrivateLinkServiceProxy]], connection_details: Optional[List[_models.ConnectionDetails]])` + - Method `RemotePrivateEndpoint.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `RemotePrivateEndpointConnection.__init__` has a new overload `def __init__(self: None, id: Optional[str])` + - Method `RemotePrivateEndpointConnection.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SystemData.__init__` has a new overload `def __init__(self: None, created_by: Optional[str], created_by_type: Optional[Union[str, _models.CreatedByType]], created_at: Optional[datetime], last_modified_by: Optional[str], last_modified_by_type: Optional[Union[str, _models.CreatedByType]], last_modified_at: Optional[datetime])` + - Method `SystemData.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TestFailoverCleanupJobModelCustomProperties.__init__` has a new overload `def __init__(self: None)` + - Method `TestFailoverCleanupJobModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TestFailoverCleanupJobModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `TestFailoverCleanupJobModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TestFailoverJobModelCustomProperties.__init__` has a new overload `def __init__(self: None)` + - Method `TestFailoverJobModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TestFailoverJobModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `TestFailoverJobModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TrackedResource.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]])` + - Method `TrackedResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareFabricAgentModelCustomProperties.__init__` has a new overload `def __init__(self: None, bios_id: str, mars_authentication_identity: _models.IdentityModel)` + - Method `VMwareFabricAgentModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareFabricAgentModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `VMwareFabricAgentModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIEventModelCustomProperties.__init__` has a new overload `def __init__(self: None)` + - Method `VMwareToAzStackHCIEventModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIEventModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `VMwareToAzStackHCIEventModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, nics_to_include: Optional[List[_models.VMwareToAzStackHCINicInput]], target_cpu_cores: Optional[int], is_dynamic_ram: Optional[bool], dynamic_memory_config: Optional[_models.ProtectedItemDynamicMemoryConfig], target_memory_in_mega_bytes: Optional[int], os_type: Optional[str])` + - Method `VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIRecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None)` + - Method `VMwareToAzStackHCIRecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMwareToAzStackHCIRecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None, instance_type: str)` + - Method `VMwareToAzStackHCIRecoveryPointModelCustomProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VaultIdentityModel.__init__` has a new overload `def __init__(self: None, type: Union[str, _models.VaultIdentityType])` + - Method `VaultIdentityModel.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `EmailConfigurationOperations.create` has a new overload `def create(self: None, resource_group_name: str, vault_name: str, email_configuration_name: str, resource: JSON, content_type: str)` + - Method `EmailConfigurationOperations.create` has a new overload `def create(self: None, resource_group_name: str, vault_name: str, email_configuration_name: str, resource: IO[bytes], content_type: str)` + - Method `EmailConfigurationOperations.create` has a new overload `def create(self: None, resource_group_name: str, vault_name: str, email_configuration_name: str, resource: EmailConfigurationModel, content_type: str)` + - Method `FabricOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, fabric_name: str, resource: JSON, content_type: str)` + - Method `FabricOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, fabric_name: str, resource: IO[bytes], content_type: str)` + - Method `FabricOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, fabric_name: str, resource: FabricModel, content_type: str)` + - Method `FabricOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, fabric_name: str, properties: JSON, content_type: str)` + - Method `FabricOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, fabric_name: str, properties: IO[bytes], content_type: str)` + - Method `FabricOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, fabric_name: str, properties: FabricModelUpdate, content_type: str)` + - Method `PolicyOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, policy_name: str, resource: JSON, content_type: str)` + - Method `PolicyOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, policy_name: str, resource: IO[bytes], content_type: str)` + - Method `PolicyOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, policy_name: str, resource: PolicyModel, content_type: str)` + - Method `ProtectedItemOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, protected_item_name: str, resource: JSON, content_type: str)` + - Method `ProtectedItemOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, protected_item_name: str, resource: IO[bytes], content_type: str)` + - Method `ProtectedItemOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, protected_item_name: str, resource: ProtectedItemModel, content_type: str)` + - Method `ProtectedItemOperations.begin_planned_failover` has a new overload `def begin_planned_failover(self: None, resource_group_name: str, vault_name: str, protected_item_name: str, body: JSON, content_type: str)` + - Method `ProtectedItemOperations.begin_planned_failover` has a new overload `def begin_planned_failover(self: None, resource_group_name: str, vault_name: str, protected_item_name: str, body: IO[bytes], content_type: str)` + - Method `ProtectedItemOperations.begin_planned_failover` has a new overload `def begin_planned_failover(self: None, resource_group_name: str, vault_name: str, protected_item_name: str, body: PlannedFailoverModel, content_type: str)` + - Method `ProtectedItemOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, vault_name: str, protected_item_name: str, properties: ProtectedItemModelUpdate, content_type: str)` + - Method `ProtectedItemOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, vault_name: str, protected_item_name: str, properties: JSON, content_type: str)` + - Method `ProtectedItemOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, vault_name: str, protected_item_name: str, properties: IO[bytes], content_type: str)` + - Method `ReplicationExtensionOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, replication_extension_name: str, resource: JSON, content_type: str)` + - Method `ReplicationExtensionOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, replication_extension_name: str, resource: IO[bytes], content_type: str)` + - Method `ReplicationExtensionOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, replication_extension_name: str, resource: ReplicationExtensionModel, content_type: str)` + - Method `VaultOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, resource: JSON, content_type: str)` + - Method `VaultOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, resource: IO[bytes], content_type: str)` + - Method `VaultOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, vault_name: str, resource: VaultModel, content_type: str)` + - Method `VaultOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, vault_name: str, properties: JSON, content_type: str)` + - Method `VaultOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, vault_name: str, properties: IO[bytes], content_type: str)` + - Method `VaultOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, vault_name: str, properties: VaultModelUpdate, content_type: str)` + - Method `CheckNameAvailabilityOperations.post` has a new overload `def post(self: None, location: str, body: Optional[CheckNameAvailabilityModel], content_type: str)` + - Method `CheckNameAvailabilityOperations.post` has a new overload `def post(self: None, location: str, body: Optional[JSON], content_type: str)` + - Method `CheckNameAvailabilityOperations.post` has a new overload `def post(self: None, location: str, body: Optional[IO[bytes]], content_type: str)` + - Method `DeploymentPreflightOperations.post` has a new overload `def post(self: None, resource_group_name: str, deployment_id: str, body: Optional[DeploymentPreflightModel], content_type: str)` + - Method `DeploymentPreflightOperations.post` has a new overload `def post(self: None, resource_group_name: str, deployment_id: str, body: Optional[JSON], content_type: str)` + - Method `DeploymentPreflightOperations.post` has a new overload `def post(self: None, resource_group_name: str, deployment_id: str, body: Optional[IO[bytes]], content_type: str)` + - Method `FabricAgentOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, fabric_name: str, fabric_agent_name: str, resource: FabricAgentModel, content_type: str)` + - Method `FabricAgentOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, fabric_name: str, fabric_agent_name: str, resource: JSON, content_type: str)` + - Method `FabricAgentOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, fabric_name: str, fabric_agent_name: str, resource: IO[bytes], content_type: str)` + - Method `PrivateEndpointConnectionProxiesOperations.create` has a new overload `def create(self: None, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_name: str, resource: PrivateEndpointConnectionProxy, content_type: str)` + - Method `PrivateEndpointConnectionProxiesOperations.create` has a new overload `def create(self: None, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_name: str, resource: JSON, content_type: str)` + - Method `PrivateEndpointConnectionProxiesOperations.create` has a new overload `def create(self: None, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_name: str, resource: IO[bytes], content_type: str)` + - Method `PrivateEndpointConnectionProxiesOperations.validate` has a new overload `def validate(self: None, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_name: str, body: PrivateEndpointConnectionProxy, content_type: str)` + - Method `PrivateEndpointConnectionProxiesOperations.validate` has a new overload `def validate(self: None, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_name: str, body: JSON, content_type: str)` + - Method `PrivateEndpointConnectionProxiesOperations.validate` has a new overload `def validate(self: None, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_name: str, body: IO[bytes], content_type: str)` + - Method `PrivateEndpointConnectionsOperations.update` has a new overload `def update(self: None, resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, resource: PrivateEndpointConnection, content_type: str)` + - Method `PrivateEndpointConnectionsOperations.update` has a new overload `def update(self: None, resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, resource: JSON, content_type: str)` + - Method `PrivateEndpointConnectionsOperations.update` has a new overload `def update(self: None, resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, resource: IO[bytes], content_type: str)` + +### Breaking Changes + + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.dra` + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.dra_operation_status` + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.fabric_operations_status` + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.policy_operation_status` + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.protected_item_operation_status` + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.recovery_points` + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.replication_extension_operation_status` + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.vault_operation_status` + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.workflow` + - Deleted or renamed client operation group `RecoveryServicesDataReplicationMgmtClient.workflow_operation_status` + - Deleted or renamed client method `RecoveryServicesDataReplicationMgmtClient.check_name_availability` + - Deleted or renamed client method `RecoveryServicesDataReplicationMgmtClient.deployment_preflight` + - Model `AzStackHCIClusterProperties` deleted or renamed its instance variable `additional_properties` + - Model `AzStackHCIFabricModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `CheckNameAvailabilityModel` deleted or renamed its instance variable `additional_properties` + - Model `CheckNameAvailabilityResponseModel` deleted or renamed its instance variable `additional_properties` + - Model `DeploymentPreflightModel` deleted or renamed its instance variable `additional_properties` + - Model `DeploymentPreflightResource` deleted or renamed its instance variable `additional_properties` + - Model `EmailConfigurationModel` deleted or renamed its instance variable `additional_properties` + - Model `EmailConfigurationModelProperties` deleted or renamed its instance variable `additional_properties` + - Model `ErrorAdditionalInfo` deleted or renamed its instance variable `additional_properties` + - Model `ErrorDetail` deleted or renamed its instance variable `additional_properties` + - Model `ErrorModel` deleted or renamed its instance variable `additional_properties` + - Model `ErrorResponse` deleted or renamed its instance variable `additional_properties` + - Model `EventModel` deleted or renamed its instance variable `additional_properties` + - Model `EventModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `EventModelProperties` deleted or renamed its instance variable `additional_properties` + - Model `FabricModel` deleted or renamed its instance variable `additional_properties` + - Model `FabricModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `FabricModelProperties` deleted or renamed its instance variable `additional_properties` + - Model `FabricModelUpdate` deleted or renamed its instance variable `additional_properties` + - Model `FailoverProtectedItemProperties` deleted or renamed its instance variable `additional_properties` + - Model `HealthErrorModel` deleted or renamed its instance variable `additional_properties` + - Model `HyperVMigrateFabricModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCIDiskInput` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCIEventModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCINicInput` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCIPlannedFailoverModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCIPolicyModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCIProtectedDiskProperties` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCIProtectedItemModelCustomProperties` deleted or renamed its instance variable `source_dra_name` + - Model `HyperVToAzStackHCIProtectedItemModelCustomProperties` deleted or renamed its instance variable `target_dra_name` + - Model `HyperVToAzStackHCIProtectedItemModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCIProtectedNicProperties` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCIRecoveryPointModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `HyperVToAzStackHCIReplicationExtensionModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `IdentityModel` deleted or renamed its instance variable `additional_properties` + - Model `InnerHealthErrorModel` deleted or renamed its instance variable `additional_properties` + - Model `Operation` deleted or renamed its instance variable `additional_properties` + - Model `OperationDisplay` deleted or renamed its instance variable `additional_properties` + - Model `OperationStatus` deleted or renamed its instance variable `additional_properties` + - Model `PlannedFailoverModel` deleted or renamed its instance variable `additional_properties` + - Model `PlannedFailoverModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `PlannedFailoverModelProperties` deleted or renamed its instance variable `additional_properties` + - Model `PolicyModel` deleted or renamed its instance variable `additional_properties` + - Model `PolicyModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `PolicyModelProperties` deleted or renamed its instance variable `additional_properties` + - Model `ProtectedItemDynamicMemoryConfig` deleted or renamed its instance variable `additional_properties` + - Model `ProtectedItemJobProperties` deleted or renamed its instance variable `additional_properties` + - Model `ProtectedItemModel` deleted or renamed its instance variable `additional_properties` + - Model `ProtectedItemModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `ProtectedItemModelProperties` deleted or renamed its instance variable `dra_id` + - Model `ProtectedItemModelProperties` deleted or renamed its instance variable `target_dra_id` + - Model `ProtectedItemModelProperties` deleted or renamed its instance variable `additional_properties` + - Model `RecoveryPointModel` deleted or renamed its instance variable `additional_properties` + - Model `RecoveryPointModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `RecoveryPointModelProperties` deleted or renamed its instance variable `additional_properties` + - Model `ReplicationExtensionModel` deleted or renamed its instance variable `additional_properties` + - Model `ReplicationExtensionModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `ReplicationExtensionModelProperties` deleted or renamed its instance variable `additional_properties` + - Model `StorageContainerProperties` deleted or renamed its instance variable `additional_properties` + - Model `TaskModel` deleted or renamed its instance variable `children_workflows` + - Model `TaskModel` deleted or renamed its instance variable `additional_properties` + - Model `TaskModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `VMwareMigrateFabricModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `VMwareToAzStackHCIDiskInput` deleted or renamed its instance variable `additional_properties` + - Model `VMwareToAzStackHCINicInput` deleted or renamed its instance variable `additional_properties` + - Model `VMwareToAzStackHCIPlannedFailoverModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `VMwareToAzStackHCIPolicyModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `VMwareToAzStackHCIProtectedDiskProperties` deleted or renamed its instance variable `additional_properties` + - Model `VMwareToAzStackHCIProtectedItemModelCustomProperties` deleted or renamed its instance variable `source_dra_name` + - Model `VMwareToAzStackHCIProtectedItemModelCustomProperties` deleted or renamed its instance variable `target_dra_name` + - Model `VMwareToAzStackHCIProtectedItemModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `VMwareToAzStackHCIProtectedNicProperties` deleted or renamed its instance variable `additional_properties` + - Model `VMwareToAzStackHCIReplicationExtensionModelCustomProperties` deleted or renamed its instance variable `additional_properties` + - Model `VaultModel` deleted or renamed its instance variable `additional_properties` + - Model `VaultModelProperties` deleted or renamed its instance variable `additional_properties` + - Model `VaultModelUpdate` deleted or renamed its instance variable `additional_properties` + - Deleted or renamed model `DraModel` + - Deleted or renamed model `DraModelCollection` + - Deleted or renamed model `DraModelCustomProperties` + - Deleted or renamed model `DraModelProperties` + - Deleted or renamed model `DraModelSystemData` + - Deleted or renamed model `EmailConfigurationModelCollection` + - Deleted or renamed model `EmailConfigurationModelSystemData` + - Deleted or renamed model `EventModelCollection` + - Deleted or renamed model `EventModelSystemData` + - Deleted or renamed model `FabricModelCollection` + - Deleted or renamed model `FabricModelSystemData` + - Deleted or renamed model `FabricModelUpdateSystemData` + - Deleted or renamed model `FailoverWorkflowModelCustomProperties` + - Deleted or renamed model `OperationModel` + - Deleted or renamed model `OperationModelCollection` + - Deleted or renamed model `OperationModelProperties` + - Deleted or renamed model `PolicyModelCollection` + - Deleted or renamed model `PolicyModelSystemData` + - Deleted or renamed model `ProtectedItemModelCollection` + - Deleted or renamed model `ProtectedItemModelPropertiesCurrentJob` + - Deleted or renamed model `ProtectedItemModelPropertiesLastFailedEnableProtectionJob` + - Deleted or renamed model `ProtectedItemModelPropertiesLastFailedPlannedFailoverJob` + - Deleted or renamed model `ProtectedItemModelPropertiesLastTestFailoverJob` + - Deleted or renamed model `ProtectedItemModelSystemData` + - Deleted or renamed model `RecoveryPointModelCollection` + - Deleted or renamed model `RecoveryPointModelSystemData` + - Deleted or renamed model `ReplicationExtensionModelCollection` + - Deleted or renamed model `ReplicationExtensionModelSystemData` + - Deleted or renamed model `SystemDataModel` + - Deleted or renamed model `TestFailoverCleanupWorkflowModelCustomProperties` + - Deleted or renamed model `TestFailoverWorkflowModelCustomProperties` + - Deleted or renamed model `VMwareDraModelCustomProperties` + - Deleted or renamed model `VaultModelCollection` + - Deleted or renamed model `VaultModelSystemData` + - Deleted or renamed model `VaultModelUpdateSystemData` + - Deleted or renamed model `WorkflowModel` + - Deleted or renamed model `WorkflowModelCollection` + - Deleted or renamed model `WorkflowModelCustomProperties` + - Deleted or renamed model `WorkflowModelProperties` + - Deleted or renamed model `WorkflowModelSystemData` + - Deleted or renamed model `WorkflowObjectType` + - Deleted or renamed model `WorkflowState` + - Method `EmailConfigurationOperations.create` inserted a `positional_or_keyword` parameter `resource` + - Method `EmailConfigurationOperations.create` deleted or renamed its parameter `body` of kind `positional_or_keyword` + - Method `EventOperations.list` changed its parameter `continuation_token_parameter` from `positional_or_keyword` to `keyword_only` + - Method `EventOperations.list` deleted or renamed its parameter `filter` of kind `positional_or_keyword` + - Method `FabricOperations.begin_create` inserted a `positional_or_keyword` parameter `resource` + - Method `FabricOperations.begin_create` deleted or renamed its parameter `body` of kind `positional_or_keyword` + - Method `FabricOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `FabricOperations.begin_update` deleted or renamed its parameter `body` of kind `positional_or_keyword` + - Method `FabricOperations.list` changed its parameter `continuation_token_parameter` from `positional_or_keyword` to `keyword_only` + - Method `FabricOperations.list_by_subscription` deleted or renamed its parameter `continuation_token_parameter` of kind `positional_or_keyword` + - Method `PolicyOperations.begin_create` inserted a `positional_or_keyword` parameter `resource` + - Method `PolicyOperations.begin_create` deleted or renamed its parameter `body` of kind `positional_or_keyword` + - Method `ProtectedItemOperations.begin_create` inserted a `positional_or_keyword` parameter `resource` + - Method `ProtectedItemOperations.begin_create` deleted or renamed its parameter `body` of kind `positional_or_keyword` + - Method `ProtectedItemOperations.begin_delete` changed its parameter `force_delete` from `positional_or_keyword` to `keyword_only` + - Method `ProtectedItemOperations.begin_planned_failover` removed default value `None` from its parameter `body` + - Method `ReplicationExtensionOperations.begin_create` inserted a `positional_or_keyword` parameter `resource` + - Method `ReplicationExtensionOperations.begin_create` deleted or renamed its parameter `body` of kind `positional_or_keyword` + - Method `VaultOperations.begin_create` inserted a `positional_or_keyword` parameter `resource` + - Method `VaultOperations.begin_create` deleted or renamed its parameter `body` of kind `positional_or_keyword` + - Method `VaultOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `VaultOperations.begin_update` deleted or renamed its parameter `body` of kind `positional_or_keyword` + - Method `VaultOperations.list` changed its parameter `continuation_token_parameter` from `positional_or_keyword` to `keyword_only` + - Method `VaultOperations.list_by_subscription` deleted or renamed its parameter `continuation_token_parameter` of kind `positional_or_keyword` + - Deleted or renamed model `DraOperationStatusOperations` + - Deleted or renamed model `DraOperations` + - Deleted or renamed model `FabricOperationsStatusOperations` + - Deleted or renamed model `PolicyOperationStatusOperations` + - Deleted or renamed model `ProtectedItemOperationStatusOperations` + - Deleted or renamed model `RecoveryPointsOperations` + - Deleted or renamed model `RecoveryServicesDataReplicationMgmtClientOperationsMixin` + - Deleted or renamed model `ReplicationExtensionOperationStatusOperations` + - Deleted or renamed model `VaultOperationStatusOperations` + - Deleted or renamed model `WorkflowOperationStatusOperations` + - Deleted or renamed model `WorkflowOperations` + - Method `ReplicationExtensionOperations.begin_create` re-ordered its parameters from `['self', 'resource_group_name', 'vault_name', 'replication_extension_name', 'body', 'kwargs']` to `['self', 'resource_group_name', 'vault_name', 'replication_extension_name', 'resource', 'kwargs']` + - Method `PolicyOperations.begin_create` re-ordered its parameters from `['self', 'resource_group_name', 'vault_name', 'policy_name', 'body', 'kwargs']` to `['self', 'resource_group_name', 'vault_name', 'policy_name', 'resource', 'kwargs']` + - Method `VaultOperations.begin_create` re-ordered its parameters from `['self', 'resource_group_name', 'vault_name', 'body', 'kwargs']` to `['self', 'resource_group_name', 'vault_name', 'resource', 'kwargs']` + - Method `VaultOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vault_name', 'body', 'kwargs']` to `['self', 'resource_group_name', 'vault_name', 'properties', 'kwargs']` + - Method `ProtectedItemOperations.begin_create` re-ordered its parameters from `['self', 'resource_group_name', 'vault_name', 'protected_item_name', 'body', 'kwargs']` to `['self', 'resource_group_name', 'vault_name', 'protected_item_name', 'resource', 'kwargs']` + - Method `FabricOperations.begin_create` re-ordered its parameters from `['self', 'resource_group_name', 'fabric_name', 'body', 'kwargs']` to `['self', 'resource_group_name', 'fabric_name', 'resource', 'kwargs']` + - Method `FabricOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'fabric_name', 'body', 'kwargs']` to `['self', 'resource_group_name', 'fabric_name', 'properties', 'kwargs']` + - Method `EmailConfigurationOperations.create` re-ordered its parameters from `['self', 'resource_group_name', 'vault_name', 'email_configuration_name', 'body', 'kwargs']` to `['self', 'resource_group_name', 'vault_name', 'email_configuration_name', 'resource', 'kwargs']` + ## 1.0.0b1 (2023-10-23) * Initial Release diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/README.md b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/README.md index 80e9a6174db9..b2c6351e349f 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/README.md +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Recoveryservicesdatareplication Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - - diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/_meta.json b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/_meta.json index 2e978e6fd2a3..5d0550618e0f 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/_meta.json +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/_meta.json @@ -1,11 +1,6 @@ { - "commit": "82e7e30a6d46c095e0c3211f3ff7bafe82a362f1", + "commit": "f3e94891900321971792a261c58d9775340c6269", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", - "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" - ], - "autorest_command": "autorest specification/recoveryservicesdatareplication/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", - "readme": "specification/recoveryservicesdatareplication/resource-manager/readme.md" + "typespec_src": "specification/recoveryservicesdatareplication/DataReplication.Management", + "@azure-tools/typespec-python": "0.44.1" } \ No newline at end of file diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/apiview-properties.json b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/apiview-properties.json new file mode 100644 index 000000000000..978ac2613f8e --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/apiview-properties.json @@ -0,0 +1,243 @@ +{ + "CrossLanguagePackageId": "Microsoft.DataReplication", + "CrossLanguageDefinitionId": { + "azure.mgmt.recoveryservicesdatareplication.models.AzStackHCIClusterProperties": "Microsoft.DataReplication.AzStackHCIClusterProperties", + "azure.mgmt.recoveryservicesdatareplication.models.FabricModelCustomProperties": "Microsoft.DataReplication.FabricModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.AzStackHCIFabricModelCustomProperties": "Microsoft.DataReplication.AzStackHCIFabricModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityModel": "Microsoft.DataReplication.CheckNameAvailabilityModel", + "azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel": "Microsoft.DataReplication.CheckNameAvailabilityResponseModel", + "azure.mgmt.recoveryservicesdatareplication.models.ConnectionDetails": "Microsoft.DataReplication.ConnectionDetails", + "azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel": "Microsoft.DataReplication.DeploymentPreflightModel", + "azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightResource": "Microsoft.DataReplication.DeploymentPreflightResource", + "azure.mgmt.recoveryservicesdatareplication.models.DiskControllerInputs": "Microsoft.DataReplication.DiskControllerInputs", + "azure.mgmt.recoveryservicesdatareplication.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.recoveryservicesdatareplication.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel": "Microsoft.DataReplication.EmailConfigurationModel", + "azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModelProperties": "Microsoft.DataReplication.EmailConfigurationModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.recoveryservicesdatareplication.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.recoveryservicesdatareplication.models.ErrorModel": "Microsoft.DataReplication.ErrorModel", + "azure.mgmt.recoveryservicesdatareplication.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.recoveryservicesdatareplication.models.EventModel": "Microsoft.DataReplication.EventModel", + "azure.mgmt.recoveryservicesdatareplication.models.EventModelCustomProperties": "Microsoft.DataReplication.EventModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.EventModelProperties": "Microsoft.DataReplication.EventModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel": "Microsoft.DataReplication.FabricAgentModel", + "azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModelCustomProperties": "Microsoft.DataReplication.FabricAgentModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModelProperties": "Microsoft.DataReplication.FabricAgentModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.recoveryservicesdatareplication.models.FabricModel": "Microsoft.DataReplication.FabricModel", + "azure.mgmt.recoveryservicesdatareplication.models.FabricModelProperties": "Microsoft.DataReplication.FabricModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdate": "Microsoft.DataReplication.FabricModelUpdate", + "azure.mgmt.recoveryservicesdatareplication.models.JobModelCustomProperties": "Microsoft.DataReplication.JobModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.FailoverJobModelCustomProperties": "Microsoft.DataReplication.FailoverJobModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.FailoverProtectedItemProperties": "Microsoft.DataReplication.FailoverProtectedItemProperties", + "azure.mgmt.recoveryservicesdatareplication.models.GroupConnectivityInformation": "Microsoft.DataReplication.GroupConnectivityInformation", + "azure.mgmt.recoveryservicesdatareplication.models.HealthErrorModel": "Microsoft.DataReplication.HealthErrorModel", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVMigrateFabricModelCustomProperties": "Microsoft.DataReplication.HyperVMigrateFabricModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIDiskInput": "Microsoft.DataReplication.HyperVToAzStackHCIDiskInput", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIEventModelCustomProperties": "Microsoft.DataReplication.HyperVToAzStackHCIEventModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCINicInput": "Microsoft.DataReplication.HyperVToAzStackHCINicInput", + "azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModelCustomProperties": "Microsoft.DataReplication.PlannedFailoverModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIPlannedFailoverModelCustomProperties": "Microsoft.DataReplication.HyperVToAzStackHCIPlannedFailoverModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.PolicyModelCustomProperties": "Microsoft.DataReplication.PolicyModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIPolicyModelCustomProperties": "Microsoft.DataReplication.HyperVToAzStackHCIPolicyModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIProtectedDiskProperties": "Microsoft.DataReplication.HyperVToAzStackHCIProtectedDiskProperties", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelCustomProperties": "Microsoft.DataReplication.ProtectedItemModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIProtectedItemModelCustomProperties": "Microsoft.DataReplication.HyperVToAzStackHCIProtectedItemModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelCustomPropertiesUpdate": "Microsoft.DataReplication.ProtectedItemModelCustomPropertiesUpdate", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate": "Microsoft.DataReplication.HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIProtectedNicProperties": "Microsoft.DataReplication.HyperVToAzStackHCIProtectedNicProperties", + "azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModelCustomProperties": "Microsoft.DataReplication.RecoveryPointModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIRecoveryPointModelCustomProperties": "Microsoft.DataReplication.HyperVToAzStackHCIRecoveryPointModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModelCustomProperties": "Microsoft.DataReplication.ReplicationExtensionModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIReplicationExtensionModelCustomProperties": "Microsoft.DataReplication.HyperVToAzStackHCIReplicationExtensionModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.IdentityModel": "Microsoft.DataReplication.IdentityModel", + "azure.mgmt.recoveryservicesdatareplication.models.InnerHealthErrorModel": "Microsoft.DataReplication.InnerHealthErrorModel", + "azure.mgmt.recoveryservicesdatareplication.models.JobModel": "Microsoft.DataReplication.JobModel", + "azure.mgmt.recoveryservicesdatareplication.models.JobModelCustomPropertiesAffectedObjectDetails": "Microsoft.DataReplication.JobModelCustomProperties.affectedObjectDetails.anonymous", + "azure.mgmt.recoveryservicesdatareplication.models.JobModelProperties": "Microsoft.DataReplication.JobModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "azure.mgmt.recoveryservicesdatareplication.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.recoveryservicesdatareplication.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.recoveryservicesdatareplication.models.OperationStatus": "Microsoft.DataReplication.OperationStatus", + "azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel": "Microsoft.DataReplication.PlannedFailoverModel", + "azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModelProperties": "Microsoft.DataReplication.PlannedFailoverModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.PolicyModel": "Microsoft.DataReplication.PolicyModel", + "azure.mgmt.recoveryservicesdatareplication.models.PolicyModelProperties": "Microsoft.DataReplication.PolicyModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpoint": "Microsoft.DataReplication.PrivateEndpoint", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection": "Microsoft.DataReplication.PrivateEndpointConnection", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy": "Microsoft.DataReplication.PrivateEndpointConnectionProxy", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxyProperties": "Microsoft.DataReplication.PrivateEndpointConnectionProxyProperties", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionResponseProperties": "Microsoft.DataReplication.PrivateEndpointConnectionResponseProperties", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkResource": "Microsoft.DataReplication.PrivateLinkResource", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkResourceProperties": "Microsoft.DataReplication.PrivateLinkResourceProperties", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkServiceConnection": "Microsoft.DataReplication.PrivateLinkServiceConnection", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkServiceConnectionState": "Microsoft.DataReplication.PrivateLinkServiceConnectionState", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkServiceProxy": "Microsoft.DataReplication.PrivateLinkServiceProxy", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemDynamicMemoryConfig": "Microsoft.DataReplication.ProtectedItemDynamicMemoryConfig", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemJobProperties": "Microsoft.DataReplication.ProtectedItemJobProperties", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel": "Microsoft.DataReplication.ProtectedItemModel", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelProperties": "Microsoft.DataReplication.ProtectedItemModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelPropertiesUpdate": "Microsoft.DataReplication.ProtectedItemModelPropertiesUpdate", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelUpdate": "Microsoft.DataReplication.ProtectedItemModelUpdate", + "azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel": "Microsoft.DataReplication.RecoveryPointModel", + "azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModelProperties": "Microsoft.DataReplication.RecoveryPointModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.RemotePrivateEndpoint": "Microsoft.DataReplication.RemotePrivateEndpoint", + "azure.mgmt.recoveryservicesdatareplication.models.RemotePrivateEndpointConnection": "Microsoft.DataReplication.RemotePrivateEndpointConnection", + "azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel": "Microsoft.DataReplication.ReplicationExtensionModel", + "azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModelProperties": "Microsoft.DataReplication.ReplicationExtensionModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.StorageContainerProperties": "Microsoft.DataReplication.StorageContainerProperties", + "azure.mgmt.recoveryservicesdatareplication.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.recoveryservicesdatareplication.models.TaskModel": "Microsoft.DataReplication.TaskModel", + "azure.mgmt.recoveryservicesdatareplication.models.TaskModelCustomProperties": "Microsoft.DataReplication.TaskModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.TestFailoverCleanupJobModelCustomProperties": "Microsoft.DataReplication.TestFailoverCleanupJobModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.TestFailoverJobModelCustomProperties": "Microsoft.DataReplication.TestFailoverJobModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.recoveryservicesdatareplication.models.VaultIdentityModel": "Microsoft.DataReplication.VaultIdentityModel", + "azure.mgmt.recoveryservicesdatareplication.models.VaultModel": "Microsoft.DataReplication.VaultModel", + "azure.mgmt.recoveryservicesdatareplication.models.VaultModelProperties": "Microsoft.DataReplication.VaultModelProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdate": "Microsoft.DataReplication.VaultModelUpdate", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareFabricAgentModelCustomProperties": "Microsoft.DataReplication.VMwareFabricAgentModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareMigrateFabricModelCustomProperties": "Microsoft.DataReplication.VMwareMigrateFabricModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIDiskInput": "Microsoft.DataReplication.VMwareToAzStackHCIDiskInput", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIEventModelCustomProperties": "Microsoft.DataReplication.VMwareToAzStackHCIEventModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCINicInput": "Microsoft.DataReplication.VMwareToAzStackHCINicInput", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIPlannedFailoverModelCustomProperties": "Microsoft.DataReplication.VMwareToAzStackHCIPlannedFailoverModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIPolicyModelCustomProperties": "Microsoft.DataReplication.VMwareToAzStackHCIPolicyModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIProtectedDiskProperties": "Microsoft.DataReplication.VMwareToAzStackHCIProtectedDiskProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIProtectedItemModelCustomProperties": "Microsoft.DataReplication.VMwareToAzStackHCIProtectedItemModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate": "Microsoft.DataReplication.VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIProtectedNicProperties": "Microsoft.DataReplication.VMwareToAzStackHCIProtectedNicProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIRecoveryPointModelCustomProperties": "Microsoft.DataReplication.VMwareToAzStackHCIRecoveryPointModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIReplicationExtensionModelCustomProperties": "Microsoft.DataReplication.VMwareToAzStackHCIReplicationExtensionModelCustomProperties", + "azure.mgmt.recoveryservicesdatareplication.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.recoveryservicesdatareplication.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.recoveryservicesdatareplication.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState": "Microsoft.DataReplication.ProvisioningState", + "azure.mgmt.recoveryservicesdatareplication.models.ReplicationVaultType": "Microsoft.DataReplication.ReplicationVaultType", + "azure.mgmt.recoveryservicesdatareplication.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "azure.mgmt.recoveryservicesdatareplication.models.VaultIdentityType": "Microsoft.DataReplication.VaultIdentityType", + "azure.mgmt.recoveryservicesdatareplication.models.HealthStatus": "Microsoft.DataReplication.HealthStatus", + "azure.mgmt.recoveryservicesdatareplication.models.JobState": "Microsoft.DataReplication.JobState", + "azure.mgmt.recoveryservicesdatareplication.models.JobObjectType": "Microsoft.DataReplication.JobObjectType", + "azure.mgmt.recoveryservicesdatareplication.models.TaskState": "Microsoft.DataReplication.TaskState", + "azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionStatus": "Microsoft.DataReplication.PrivateEndpointConnectionStatus", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectionState": "Microsoft.DataReplication.ProtectionState", + "azure.mgmt.recoveryservicesdatareplication.models.TestFailoverState": "Microsoft.DataReplication.TestFailoverState", + "azure.mgmt.recoveryservicesdatareplication.models.ResynchronizationState": "Microsoft.DataReplication.ResynchronizationState", + "azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemActiveLocation": "Microsoft.DataReplication.ProtectedItemActiveLocation", + "azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection": "Microsoft.DataReplication.VMNicSelection", + "azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzureMigrateResyncState": "Microsoft.DataReplication.VMwareToAzureMigrateResyncState", + "azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointType": "Microsoft.DataReplication.RecoveryPointType", + "azure.mgmt.recoveryservicesdatareplication.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.recoveryservicesdatareplication.operations.EmailConfigurationOperations.get": "Microsoft.DataReplication.EmailConfiguration.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.EmailConfigurationOperations.get": "Microsoft.DataReplication.EmailConfiguration.get", + "azure.mgmt.recoveryservicesdatareplication.operations.EmailConfigurationOperations.create": "Microsoft.DataReplication.EmailConfiguration.create", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.EmailConfigurationOperations.create": "Microsoft.DataReplication.EmailConfiguration.create", + "azure.mgmt.recoveryservicesdatareplication.operations.EmailConfigurationOperations.list": "Microsoft.DataReplication.EmailConfiguration.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.EmailConfigurationOperations.list": "Microsoft.DataReplication.EmailConfiguration.list", + "azure.mgmt.recoveryservicesdatareplication.operations.VaultOperations.get": "Microsoft.DataReplication.Vault.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.VaultOperations.get": "Microsoft.DataReplication.Vault.get", + "azure.mgmt.recoveryservicesdatareplication.operations.VaultOperations.begin_create": "Microsoft.DataReplication.Vault.create", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.VaultOperations.begin_create": "Microsoft.DataReplication.Vault.create", + "azure.mgmt.recoveryservicesdatareplication.operations.VaultOperations.begin_update": "Microsoft.DataReplication.Vault.update", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.VaultOperations.begin_update": "Microsoft.DataReplication.Vault.update", + "azure.mgmt.recoveryservicesdatareplication.operations.VaultOperations.begin_delete": "Microsoft.DataReplication.Vault.delete", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.VaultOperations.begin_delete": "Microsoft.DataReplication.Vault.delete", + "azure.mgmt.recoveryservicesdatareplication.operations.VaultOperations.list": "Microsoft.DataReplication.Vault.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.VaultOperations.list": "Microsoft.DataReplication.Vault.list", + "azure.mgmt.recoveryservicesdatareplication.operations.VaultOperations.list_by_subscription": "Microsoft.DataReplication.Vault.listBySubscription", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.VaultOperations.list_by_subscription": "Microsoft.DataReplication.Vault.listBySubscription", + "azure.mgmt.recoveryservicesdatareplication.operations.EventOperations.get": "Microsoft.DataReplication.Event.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.EventOperations.get": "Microsoft.DataReplication.Event.get", + "azure.mgmt.recoveryservicesdatareplication.operations.EventOperations.list": "Microsoft.DataReplication.Event.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.EventOperations.list": "Microsoft.DataReplication.Event.list", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricOperations.get": "Microsoft.DataReplication.Fabric.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricOperations.get": "Microsoft.DataReplication.Fabric.get", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricOperations.begin_create": "Microsoft.DataReplication.Fabric.create", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricOperations.begin_create": "Microsoft.DataReplication.Fabric.create", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricOperations.begin_update": "Microsoft.DataReplication.Fabric.update", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricOperations.begin_update": "Microsoft.DataReplication.Fabric.update", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricOperations.begin_delete": "Microsoft.DataReplication.Fabric.delete", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricOperations.begin_delete": "Microsoft.DataReplication.Fabric.delete", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricOperations.list": "Microsoft.DataReplication.Fabric.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricOperations.list": "Microsoft.DataReplication.Fabric.list", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricOperations.list_by_subscription": "Microsoft.DataReplication.Fabric.listBySubscription", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricOperations.list_by_subscription": "Microsoft.DataReplication.Fabric.listBySubscription", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricAgentOperations.get": "Microsoft.DataReplication.FabricAgent.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricAgentOperations.get": "Microsoft.DataReplication.FabricAgent.get", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricAgentOperations.begin_create": "Microsoft.DataReplication.FabricAgent.create", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricAgentOperations.begin_create": "Microsoft.DataReplication.FabricAgent.create", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricAgentOperations.begin_delete": "Microsoft.DataReplication.FabricAgent.delete", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricAgentOperations.begin_delete": "Microsoft.DataReplication.FabricAgent.delete", + "azure.mgmt.recoveryservicesdatareplication.operations.FabricAgentOperations.list": "Microsoft.DataReplication.FabricAgent.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricAgentOperations.list": "Microsoft.DataReplication.FabricAgent.list", + "azure.mgmt.recoveryservicesdatareplication.operations.JobOperations.get": "Microsoft.DataReplication.Job.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.JobOperations.get": "Microsoft.DataReplication.Job.get", + "azure.mgmt.recoveryservicesdatareplication.operations.JobOperations.list": "Microsoft.DataReplication.Job.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.JobOperations.list": "Microsoft.DataReplication.Job.list", + "azure.mgmt.recoveryservicesdatareplication.operations.PolicyOperations.get": "Microsoft.DataReplication.Policy.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PolicyOperations.get": "Microsoft.DataReplication.Policy.get", + "azure.mgmt.recoveryservicesdatareplication.operations.PolicyOperations.begin_create": "Microsoft.DataReplication.Policy.create", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PolicyOperations.begin_create": "Microsoft.DataReplication.Policy.create", + "azure.mgmt.recoveryservicesdatareplication.operations.PolicyOperations.begin_delete": "Microsoft.DataReplication.Policy.delete", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PolicyOperations.begin_delete": "Microsoft.DataReplication.Policy.delete", + "azure.mgmt.recoveryservicesdatareplication.operations.PolicyOperations.list": "Microsoft.DataReplication.Policy.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PolicyOperations.list": "Microsoft.DataReplication.Policy.list", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.DataReplication.PrivateEndpointConnections.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.DataReplication.PrivateEndpointConnections.get", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionsOperations.update": "Microsoft.DataReplication.PrivateEndpointConnections.update", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionsOperations.update": "Microsoft.DataReplication.PrivateEndpointConnections.update", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.DataReplication.PrivateEndpointConnections.delete", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.DataReplication.PrivateEndpointConnections.delete", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionsOperations.list": "Microsoft.DataReplication.PrivateEndpointConnections.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionsOperations.list": "Microsoft.DataReplication.PrivateEndpointConnections.list", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionProxiesOperations.get": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionProxiesOperations.get": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.get", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionProxiesOperations.create": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.create", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionProxiesOperations.create": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.create", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionProxiesOperations.begin_delete": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.delete", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionProxiesOperations.begin_delete": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.delete", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionProxiesOperations.list": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionProxiesOperations.list": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.list", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionProxiesOperations.validate": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.validate", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionProxiesOperations.validate": "Microsoft.DataReplication.PrivateEndpointConnectionProxies.validate", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateLinkResourcesOperations.get": "Microsoft.DataReplication.PrivateLinkResources.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateLinkResourcesOperations.get": "Microsoft.DataReplication.PrivateLinkResources.get", + "azure.mgmt.recoveryservicesdatareplication.operations.PrivateLinkResourcesOperations.list": "Microsoft.DataReplication.PrivateLinkResources.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateLinkResourcesOperations.list": "Microsoft.DataReplication.PrivateLinkResources.list", + "azure.mgmt.recoveryservicesdatareplication.operations.ProtectedItemOperations.get": "Microsoft.DataReplication.ProtectedItem.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ProtectedItemOperations.get": "Microsoft.DataReplication.ProtectedItem.get", + "azure.mgmt.recoveryservicesdatareplication.operations.ProtectedItemOperations.begin_create": "Microsoft.DataReplication.ProtectedItem.create", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ProtectedItemOperations.begin_create": "Microsoft.DataReplication.ProtectedItem.create", + "azure.mgmt.recoveryservicesdatareplication.operations.ProtectedItemOperations.begin_update": "Microsoft.DataReplication.ProtectedItem.update", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ProtectedItemOperations.begin_update": "Microsoft.DataReplication.ProtectedItem.update", + "azure.mgmt.recoveryservicesdatareplication.operations.ProtectedItemOperations.begin_delete": "Microsoft.DataReplication.ProtectedItem.delete", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ProtectedItemOperations.begin_delete": "Microsoft.DataReplication.ProtectedItem.delete", + "azure.mgmt.recoveryservicesdatareplication.operations.ProtectedItemOperations.list": "Microsoft.DataReplication.ProtectedItem.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ProtectedItemOperations.list": "Microsoft.DataReplication.ProtectedItem.list", + "azure.mgmt.recoveryservicesdatareplication.operations.ProtectedItemOperations.begin_planned_failover": "Microsoft.DataReplication.ProtectedItem.plannedFailover", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ProtectedItemOperations.begin_planned_failover": "Microsoft.DataReplication.ProtectedItem.plannedFailover", + "azure.mgmt.recoveryservicesdatareplication.operations.RecoveryPointOperations.get": "Microsoft.DataReplication.RecoveryPoint.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.RecoveryPointOperations.get": "Microsoft.DataReplication.RecoveryPoint.get", + "azure.mgmt.recoveryservicesdatareplication.operations.RecoveryPointOperations.list": "Microsoft.DataReplication.RecoveryPoint.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.RecoveryPointOperations.list": "Microsoft.DataReplication.RecoveryPoint.list", + "azure.mgmt.recoveryservicesdatareplication.operations.ReplicationExtensionOperations.get": "Microsoft.DataReplication.ReplicationExtension.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ReplicationExtensionOperations.get": "Microsoft.DataReplication.ReplicationExtension.get", + "azure.mgmt.recoveryservicesdatareplication.operations.ReplicationExtensionOperations.begin_create": "Microsoft.DataReplication.ReplicationExtension.create", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ReplicationExtensionOperations.begin_create": "Microsoft.DataReplication.ReplicationExtension.create", + "azure.mgmt.recoveryservicesdatareplication.operations.ReplicationExtensionOperations.begin_delete": "Microsoft.DataReplication.ReplicationExtension.delete", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ReplicationExtensionOperations.begin_delete": "Microsoft.DataReplication.ReplicationExtension.delete", + "azure.mgmt.recoveryservicesdatareplication.operations.ReplicationExtensionOperations.list": "Microsoft.DataReplication.ReplicationExtension.list", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.ReplicationExtensionOperations.list": "Microsoft.DataReplication.ReplicationExtension.list", + "azure.mgmt.recoveryservicesdatareplication.operations.CheckNameAvailabilityOperations.post": "Microsoft.DataReplication.CheckNameAvailability.post", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.CheckNameAvailabilityOperations.post": "Microsoft.DataReplication.CheckNameAvailability.post", + "azure.mgmt.recoveryservicesdatareplication.operations.DeploymentPreflightOperations.post": "Microsoft.DataReplication.DeploymentPreflight.post", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.DeploymentPreflightOperations.post": "Microsoft.DataReplication.DeploymentPreflight.post", + "azure.mgmt.recoveryservicesdatareplication.operations.OperationResultsOperations.get": "Microsoft.DataReplication.OperationResults.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.OperationResultsOperations.get": "Microsoft.DataReplication.OperationResults.get", + "azure.mgmt.recoveryservicesdatareplication.operations.LocationBasedOperationResultsOperations.get": "Microsoft.DataReplication.LocationBasedOperationResults.get", + "azure.mgmt.recoveryservicesdatareplication.aio.operations.LocationBasedOperationResultsOperations.get": "Microsoft.DataReplication.LocationBasedOperationResults.get" + } +} \ No newline at end of file diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/__init__.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/__init__.py index e96e0b432e4f..d4615eecff21 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/__init__.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/__init__.py @@ -2,18 +2,24 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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 ._recovery_services_data_replication_mgmt_client import RecoveryServicesDataReplicationMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import RecoveryServicesDataReplicationMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "RecoveryServicesDataReplicationMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_client.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_client.py new file mode 100644 index 000000000000..add707fb6e75 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_client.py @@ -0,0 +1,223 @@ +# 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from ._configuration import RecoveryServicesDataReplicationMgmtClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import ( + CheckNameAvailabilityOperations, + DeploymentPreflightOperations, + EmailConfigurationOperations, + EventOperations, + FabricAgentOperations, + FabricOperations, + JobOperations, + LocationBasedOperationResultsOperations, + OperationResultsOperations, + Operations, + PolicyOperations, + PrivateEndpointConnectionProxiesOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ProtectedItemOperations, + RecoveryPointOperations, + ReplicationExtensionOperations, + VaultOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class RecoveryServicesDataReplicationMgmtClient: # pylint: disable=too-many-instance-attributes,name-too-long + """A first party Azure service enabling the data replication. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.recoveryservicesdatareplication.operations.Operations + :ivar email_configuration: EmailConfigurationOperations operations + :vartype email_configuration: + azure.mgmt.recoveryservicesdatareplication.operations.EmailConfigurationOperations + :ivar vault: VaultOperations operations + :vartype vault: azure.mgmt.recoveryservicesdatareplication.operations.VaultOperations + :ivar event: EventOperations operations + :vartype event: azure.mgmt.recoveryservicesdatareplication.operations.EventOperations + :ivar fabric: FabricOperations operations + :vartype fabric: azure.mgmt.recoveryservicesdatareplication.operations.FabricOperations + :ivar fabric_agent: FabricAgentOperations operations + :vartype fabric_agent: + azure.mgmt.recoveryservicesdatareplication.operations.FabricAgentOperations + :ivar job: JobOperations operations + :vartype job: azure.mgmt.recoveryservicesdatareplication.operations.JobOperations + :ivar policy: PolicyOperations operations + :vartype policy: azure.mgmt.recoveryservicesdatareplication.operations.PolicyOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionsOperations + :ivar private_endpoint_connection_proxies: PrivateEndpointConnectionProxiesOperations + operations + :vartype private_endpoint_connection_proxies: + azure.mgmt.recoveryservicesdatareplication.operations.PrivateEndpointConnectionProxiesOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.recoveryservicesdatareplication.operations.PrivateLinkResourcesOperations + :ivar protected_item: ProtectedItemOperations operations + :vartype protected_item: + azure.mgmt.recoveryservicesdatareplication.operations.ProtectedItemOperations + :ivar recovery_point: RecoveryPointOperations operations + :vartype recovery_point: + azure.mgmt.recoveryservicesdatareplication.operations.RecoveryPointOperations + :ivar replication_extension: ReplicationExtensionOperations operations + :vartype replication_extension: + azure.mgmt.recoveryservicesdatareplication.operations.ReplicationExtensionOperations + :ivar check_name_availability: CheckNameAvailabilityOperations operations + :vartype check_name_availability: + azure.mgmt.recoveryservicesdatareplication.operations.CheckNameAvailabilityOperations + :ivar deployment_preflight: DeploymentPreflightOperations operations + :vartype deployment_preflight: + azure.mgmt.recoveryservicesdatareplication.operations.DeploymentPreflightOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: + azure.mgmt.recoveryservicesdatareplication.operations.OperationResultsOperations + :ivar location_based_operation_results: LocationBasedOperationResultsOperations operations + :vartype location_based_operation_results: + azure.mgmt.recoveryservicesdatareplication.operations.LocationBasedOperationResultsOperations + :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 None. + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2024-09-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: Optional[str] = None, **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = RecoveryServicesDataReplicationMgmtClientConfiguration( + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **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=cast(str, _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.email_configuration = EmailConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vault = VaultOperations(self._client, self._config, self._serialize, self._deserialize) + self.event = EventOperations(self._client, self._config, self._serialize, self._deserialize) + self.fabric = FabricOperations(self._client, self._config, self._serialize, self._deserialize) + self.fabric_agent = FabricAgentOperations(self._client, self._config, self._serialize, self._deserialize) + self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize) + self.policy = PolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connection_proxies = PrivateEndpointConnectionProxiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protected_item = ProtectedItemOperations(self._client, self._config, self._serialize, self._deserialize) + self.recovery_point = RecoveryPointOperations(self._client, self._config, self._serialize, self._deserialize) + self.replication_extension = ReplicationExtensionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.check_name_availability = CheckNameAvailabilityOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.deployment_preflight = DeploymentPreflightOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operation_results = OperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.location_based_operation_results = LocationBasedOperationResultsOperations( + 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/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_configuration.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_configuration.py index a13ca8e5e8fb..44c3ff34eb46 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_configuration.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_configuration.py @@ -1,44 +1,48 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class RecoveryServicesDataReplicationMgmtClientConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class RecoveryServicesDataReplicationMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for RecoveryServicesDataReplicationMgmtClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :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 - :keyword api_version: Api Version. Default value is "2021-02-16-preview". Note that overriding - this default value may result in unsupported behavior. + :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 "2024-09-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(RecoveryServicesDataReplicationMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2021-02-16-preview") + 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", "2024-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -47,9 +51,11 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs 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-recoveryservicesdatareplication/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -58,9 +64,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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( diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_patch.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_patch.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_recovery_services_data_replication_mgmt_client.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_recovery_services_data_replication_mgmt_client.py deleted file mode 100644 index 706bade06ff3..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_recovery_services_data_replication_mgmt_client.py +++ /dev/null @@ -1,194 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from ._configuration import RecoveryServicesDataReplicationMgmtClientConfiguration -from ._serialization import Deserializer, Serializer -from .operations import ( - DraOperationStatusOperations, - DraOperations, - EmailConfigurationOperations, - EventOperations, - FabricOperations, - FabricOperationsStatusOperations, - Operations, - PolicyOperationStatusOperations, - PolicyOperations, - ProtectedItemOperationStatusOperations, - ProtectedItemOperations, - RecoveryPointsOperations, - RecoveryServicesDataReplicationMgmtClientOperationsMixin, - ReplicationExtensionOperationStatusOperations, - ReplicationExtensionOperations, - VaultOperationStatusOperations, - VaultOperations, - WorkflowOperationStatusOperations, - WorkflowOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class RecoveryServicesDataReplicationMgmtClient( - RecoveryServicesDataReplicationMgmtClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """A first party Azure service enabling the data replication. - - :ivar dra: DraOperations operations - :vartype dra: azure.mgmt.recoveryservicesdatareplication.operations.DraOperations - :ivar dra_operation_status: DraOperationStatusOperations operations - :vartype dra_operation_status: - azure.mgmt.recoveryservicesdatareplication.operations.DraOperationStatusOperations - :ivar email_configuration: EmailConfigurationOperations operations - :vartype email_configuration: - azure.mgmt.recoveryservicesdatareplication.operations.EmailConfigurationOperations - :ivar event: EventOperations operations - :vartype event: azure.mgmt.recoveryservicesdatareplication.operations.EventOperations - :ivar fabric: FabricOperations operations - :vartype fabric: azure.mgmt.recoveryservicesdatareplication.operations.FabricOperations - :ivar fabric_operations_status: FabricOperationsStatusOperations operations - :vartype fabric_operations_status: - azure.mgmt.recoveryservicesdatareplication.operations.FabricOperationsStatusOperations - :ivar policy: PolicyOperations operations - :vartype policy: azure.mgmt.recoveryservicesdatareplication.operations.PolicyOperations - :ivar policy_operation_status: PolicyOperationStatusOperations operations - :vartype policy_operation_status: - azure.mgmt.recoveryservicesdatareplication.operations.PolicyOperationStatusOperations - :ivar protected_item: ProtectedItemOperations operations - :vartype protected_item: - azure.mgmt.recoveryservicesdatareplication.operations.ProtectedItemOperations - :ivar protected_item_operation_status: ProtectedItemOperationStatusOperations operations - :vartype protected_item_operation_status: - azure.mgmt.recoveryservicesdatareplication.operations.ProtectedItemOperationStatusOperations - :ivar recovery_points: RecoveryPointsOperations operations - :vartype recovery_points: - azure.mgmt.recoveryservicesdatareplication.operations.RecoveryPointsOperations - :ivar replication_extension: ReplicationExtensionOperations operations - :vartype replication_extension: - azure.mgmt.recoveryservicesdatareplication.operations.ReplicationExtensionOperations - :ivar replication_extension_operation_status: ReplicationExtensionOperationStatusOperations - operations - :vartype replication_extension_operation_status: - azure.mgmt.recoveryservicesdatareplication.operations.ReplicationExtensionOperationStatusOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.recoveryservicesdatareplication.operations.Operations - :ivar vault: VaultOperations operations - :vartype vault: azure.mgmt.recoveryservicesdatareplication.operations.VaultOperations - :ivar vault_operation_status: VaultOperationStatusOperations operations - :vartype vault_operation_status: - azure.mgmt.recoveryservicesdatareplication.operations.VaultOperationStatusOperations - :ivar workflow: WorkflowOperations operations - :vartype workflow: azure.mgmt.recoveryservicesdatareplication.operations.WorkflowOperations - :ivar workflow_operation_status: WorkflowOperationStatusOperations operations - :vartype workflow_operation_status: - azure.mgmt.recoveryservicesdatareplication.operations.WorkflowOperationStatusOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-02-16-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = RecoveryServicesDataReplicationMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.dra = DraOperations(self._client, self._config, self._serialize, self._deserialize) - self.dra_operation_status = DraOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.email_configuration = EmailConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.event = EventOperations(self._client, self._config, self._serialize, self._deserialize) - self.fabric = FabricOperations(self._client, self._config, self._serialize, self._deserialize) - self.fabric_operations_status = FabricOperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.policy = PolicyOperations(self._client, self._config, self._serialize, self._deserialize) - self.policy_operation_status = PolicyOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.protected_item = ProtectedItemOperations(self._client, self._config, self._serialize, self._deserialize) - self.protected_item_operation_status = ProtectedItemOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.replication_extension = ReplicationExtensionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.replication_extension_operation_status = ReplicationExtensionOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.vault = VaultOperations(self._client, self._config, self._serialize, self._deserialize) - self.vault_operation_status = VaultOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.workflow = WorkflowOperations(self._client, self._config, self._serialize, self._deserialize) - self.workflow_operation_status = WorkflowOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "RecoveryServicesDataReplicationMgmtClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/__init__.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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. +# -------------------------------------------------------------------------- diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/model_base.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/model_base.py new file mode 100644 index 000000000000..49d5c7259389 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/model_base.py @@ -0,0 +1,1232 @@ +# 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. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# 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 collections.abc import MutableMapping +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 + +_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]): + 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: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + 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: # pylint: disable=arguments-differ + """ + 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: ... # pylint: disable=signature-differs + + 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) + + 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 # pylint: disable=no-member + 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/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_serialization.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/serialization.py similarity index 80% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_serialization.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/serialization.py index 4bae2292227b..eb86ea23c965 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_serialization.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # 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. -# +# 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: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -48,11 +30,8 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, - Mapping, ) try: @@ -62,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +70,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :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 @@ -112,7 +93,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -124,7 +105,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + 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 @@ -143,7 +124,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + 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 @@ -153,6 +136,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], 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 @@ -170,13 +158,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -184,80 +165,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: - self.additional_properties: Dict[str, Any] = {} - for k in kwargs: + 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): @@ -305,13 +244,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """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.""" + """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: @@ -331,7 +280,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -340,7 +293,7 @@ def _create_xml_node(cls): 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 azure from this model. + """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)`. @@ -351,7 +304,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -385,12 +340,15 @@ def my_key_transformer(key, attr_desc, value): 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(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + 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): @@ -400,30 +358,31 @@ def _infer_class_models(cls): 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: + 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: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + 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 + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -431,9 +390,11 @@ def from_dict( 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 + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -445,7 +406,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -453,21 +414,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + 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. - Remove the polymorphic key from the initial data. + + :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.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + 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: @@ -506,11 +471,13 @@ def _decode_attribute_map_key(key): 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(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -545,7 +512,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,17 +528,20 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + 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 target_obj: The data to be serialized. + :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. + :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) @@ -597,12 +567,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + 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(attr_name, {}).get("readonly", False): + 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"] == "": @@ -638,7 +610,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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 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 @@ -649,7 +622,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,18 +641,18 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) - else: - return serialized + raise SerializationError(msg) from err + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :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 + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -708,20 +681,22 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str 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 - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :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) @@ -730,30 +705,30 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + 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 data: The data to be serialized. + :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. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :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 str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + 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) @@ -763,19 +738,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + 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 data: The data to be serialized. + :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 + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -784,32 +760,31 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + 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 data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :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 AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -824,12 +799,11 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) - else: - return self._serialize(data, **kwargs) + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + 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 @@ -845,23 +819,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param 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 + 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 data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -875,8 +852,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -886,15 +862,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -949,9 +923,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -975,7 +948,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + 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 @@ -983,6 +956,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -993,7 +967,7 @@ def serialize_object(self, attr, **kwargs): 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 unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1007,7 +981,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1038,56 +1012,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + 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)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :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): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + 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) @@ -1095,11 +1074,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + 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) @@ -1109,30 +1089,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + 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): + 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. + :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: - raise TypeError("RFC1123 object must be valid Datetime object.") + 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], @@ -1145,12 +1127,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + 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. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,19 +1153,20 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + 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 + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1190,11 +1174,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,14 +1193,15 @@ def rest_key_extractor(attr, attr_desc, 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 - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,7 +1215,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, 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 - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1238,17 +1222,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +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): +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) @@ -1285,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1337,22 +1333,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # 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. + ) + 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: @@ -1360,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1369,9 +1364,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + 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[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1386,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + 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 @@ -1407,27 +1402,29 @@ def __call__(self, target_obj, response_data, content_type=None): :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. + :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): + 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. + :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(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1444,15 +1441,15 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + 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"... @@ -1481,10 +1478,9 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + 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: @@ -1511,18 +1507,20 @@ def _classify_target(self, target, data): :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, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + 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 @@ -1537,10 +1535,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :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: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1558,10 +1558,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :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", {}) @@ -1578,31 +1580,42 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :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() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + 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 + 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)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1611,15 +1624,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + 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. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1633,7 +1647,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + 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) @@ -1652,15 +1670,15 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) - else: - return self._deserialize(obj_type, data) + 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: @@ -1677,6 +1695,7 @@ def deserialize_dict(self, attr, dict_type): :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): @@ -1687,20 +1706,21 @@ def deserialize_dict(self, attr, dict_type): 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): + 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. + :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, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1726,11 +1746,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_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 @@ -1738,8 +1757,9 @@ def deserialize_basic(self, attr, data_type): :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. + :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 @@ -1749,24 +1769,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + 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 + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1774,6 +1793,7 @@ def deserialize_unicode(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, @@ -1787,8 +1807,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1800,6 +1819,7 @@ def deserialize_enum(data, enum_obj): :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: @@ -1808,12 +1828,11 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1829,8 +1848,9 @@ 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. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1841,8 +1861,9 @@ 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. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1856,24 +1877,26 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + 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. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1884,8 +1907,9 @@ 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. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1893,32 +1917,33 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) - else: - return duration + 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. + :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=None, defaultday=None) + 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. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1931,31 +1956,32 @@ 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. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *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_with_traceback(DeserializationError, msg, err) - else: - return date_obj + 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. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1982,9 +2008,8 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj @staticmethod def deserialize_unix(attr): @@ -1992,15 +2017,16 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :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_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_vendor.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_vendor.py deleted file mode 100644 index 69f25b502ec4..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_vendor.py +++ /dev/null @@ -1,36 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport import HttpRequest - -from ._configuration import RecoveryServicesDataReplicationMgmtClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import PipelineClient - - from ._serialization import Deserializer, Serializer - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -class RecoveryServicesDataReplicationMgmtClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "PipelineClient" - _config: RecoveryServicesDataReplicationMgmtClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_version.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_version.py index e5754a47ce68..0ec13ea52bbf 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_version.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/_version.py @@ -2,8 +2,8 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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" +VERSION = "1.0.0" diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/__init__.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/__init__.py index 8e2727907bbb..6f17c508dff3 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/__init__.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/__init__.py @@ -2,15 +2,21 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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 ._recovery_services_data_replication_mgmt_client import RecoveryServicesDataReplicationMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import RecoveryServicesDataReplicationMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "RecoveryServicesDataReplicationMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_recovery_services_data_replication_mgmt_client.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_client.py similarity index 50% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_recovery_services_data_replication_mgmt_client.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_client.py index e23fab178e10..3868c45b2816 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_recovery_services_data_replication_mgmt_client.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_client.py @@ -2,172 +2,201 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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 import Any, Awaitable, Optional, TYPE_CHECKING, cast +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import RecoveryServicesDataReplicationMgmtClientConfiguration from .operations import ( - DraOperationStatusOperations, - DraOperations, + CheckNameAvailabilityOperations, + DeploymentPreflightOperations, EmailConfigurationOperations, EventOperations, + FabricAgentOperations, FabricOperations, - FabricOperationsStatusOperations, + JobOperations, + LocationBasedOperationResultsOperations, + OperationResultsOperations, Operations, - PolicyOperationStatusOperations, PolicyOperations, - ProtectedItemOperationStatusOperations, + PrivateEndpointConnectionProxiesOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, ProtectedItemOperations, - RecoveryPointsOperations, - RecoveryServicesDataReplicationMgmtClientOperationsMixin, - ReplicationExtensionOperationStatusOperations, + RecoveryPointOperations, ReplicationExtensionOperations, - VaultOperationStatusOperations, VaultOperations, - WorkflowOperationStatusOperations, - WorkflowOperations, ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class RecoveryServicesDataReplicationMgmtClient( - RecoveryServicesDataReplicationMgmtClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class RecoveryServicesDataReplicationMgmtClient: # pylint: disable=too-many-instance-attributes,name-too-long """A first party Azure service enabling the data replication. - :ivar dra: DraOperations operations - :vartype dra: azure.mgmt.recoveryservicesdatareplication.aio.operations.DraOperations - :ivar dra_operation_status: DraOperationStatusOperations operations - :vartype dra_operation_status: - azure.mgmt.recoveryservicesdatareplication.aio.operations.DraOperationStatusOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.recoveryservicesdatareplication.aio.operations.Operations :ivar email_configuration: EmailConfigurationOperations operations :vartype email_configuration: azure.mgmt.recoveryservicesdatareplication.aio.operations.EmailConfigurationOperations + :ivar vault: VaultOperations operations + :vartype vault: azure.mgmt.recoveryservicesdatareplication.aio.operations.VaultOperations :ivar event: EventOperations operations :vartype event: azure.mgmt.recoveryservicesdatareplication.aio.operations.EventOperations :ivar fabric: FabricOperations operations :vartype fabric: azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricOperations - :ivar fabric_operations_status: FabricOperationsStatusOperations operations - :vartype fabric_operations_status: - azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricOperationsStatusOperations + :ivar fabric_agent: FabricAgentOperations operations + :vartype fabric_agent: + azure.mgmt.recoveryservicesdatareplication.aio.operations.FabricAgentOperations + :ivar job: JobOperations operations + :vartype job: azure.mgmt.recoveryservicesdatareplication.aio.operations.JobOperations :ivar policy: PolicyOperations operations :vartype policy: azure.mgmt.recoveryservicesdatareplication.aio.operations.PolicyOperations - :ivar policy_operation_status: PolicyOperationStatusOperations operations - :vartype policy_operation_status: - azure.mgmt.recoveryservicesdatareplication.aio.operations.PolicyOperationStatusOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_endpoint_connection_proxies: PrivateEndpointConnectionProxiesOperations + operations + :vartype private_endpoint_connection_proxies: + azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateEndpointConnectionProxiesOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.recoveryservicesdatareplication.aio.operations.PrivateLinkResourcesOperations :ivar protected_item: ProtectedItemOperations operations :vartype protected_item: azure.mgmt.recoveryservicesdatareplication.aio.operations.ProtectedItemOperations - :ivar protected_item_operation_status: ProtectedItemOperationStatusOperations operations - :vartype protected_item_operation_status: - azure.mgmt.recoveryservicesdatareplication.aio.operations.ProtectedItemOperationStatusOperations - :ivar recovery_points: RecoveryPointsOperations operations - :vartype recovery_points: - azure.mgmt.recoveryservicesdatareplication.aio.operations.RecoveryPointsOperations + :ivar recovery_point: RecoveryPointOperations operations + :vartype recovery_point: + azure.mgmt.recoveryservicesdatareplication.aio.operations.RecoveryPointOperations :ivar replication_extension: ReplicationExtensionOperations operations :vartype replication_extension: azure.mgmt.recoveryservicesdatareplication.aio.operations.ReplicationExtensionOperations - :ivar replication_extension_operation_status: ReplicationExtensionOperationStatusOperations - operations - :vartype replication_extension_operation_status: - azure.mgmt.recoveryservicesdatareplication.aio.operations.ReplicationExtensionOperationStatusOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.recoveryservicesdatareplication.aio.operations.Operations - :ivar vault: VaultOperations operations - :vartype vault: azure.mgmt.recoveryservicesdatareplication.aio.operations.VaultOperations - :ivar vault_operation_status: VaultOperationStatusOperations operations - :vartype vault_operation_status: - azure.mgmt.recoveryservicesdatareplication.aio.operations.VaultOperationStatusOperations - :ivar workflow: WorkflowOperations operations - :vartype workflow: azure.mgmt.recoveryservicesdatareplication.aio.operations.WorkflowOperations - :ivar workflow_operation_status: WorkflowOperationStatusOperations operations - :vartype workflow_operation_status: - azure.mgmt.recoveryservicesdatareplication.aio.operations.WorkflowOperationStatusOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar check_name_availability: CheckNameAvailabilityOperations operations + :vartype check_name_availability: + azure.mgmt.recoveryservicesdatareplication.aio.operations.CheckNameAvailabilityOperations + :ivar deployment_preflight: DeploymentPreflightOperations operations + :vartype deployment_preflight: + azure.mgmt.recoveryservicesdatareplication.aio.operations.DeploymentPreflightOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: + azure.mgmt.recoveryservicesdatareplication.aio.operations.OperationResultsOperations + :ivar location_based_operation_results: LocationBasedOperationResultsOperations operations + :vartype location_based_operation_results: + azure.mgmt.recoveryservicesdatareplication.aio.operations.LocationBasedOperationResultsOperations + :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 URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2021-02-16-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-09-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 + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = RecoveryServicesDataReplicationMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.dra = DraOperations(self._client, self._config, self._serialize, self._deserialize) - self.dra_operation_status = DraOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize + _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=cast(str, _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.email_configuration = EmailConfigurationOperations( self._client, self._config, self._serialize, self._deserialize ) + self.vault = VaultOperations(self._client, self._config, self._serialize, self._deserialize) self.event = EventOperations(self._client, self._config, self._serialize, self._deserialize) self.fabric = FabricOperations(self._client, self._config, self._serialize, self._deserialize) - self.fabric_operations_status = FabricOperationsStatusOperations( + self.fabric_agent = FabricAgentOperations(self._client, self._config, self._serialize, self._deserialize) + self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize) + self.policy = PolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.policy = PolicyOperations(self._client, self._config, self._serialize, self._deserialize) - self.policy_operation_status = PolicyOperationStatusOperations( + self.private_endpoint_connection_proxies = PrivateEndpointConnectionProxiesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.protected_item = ProtectedItemOperations(self._client, self._config, self._serialize, self._deserialize) - self.protected_item_operation_status = ProtectedItemOperationStatusOperations( + self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.protected_item = ProtectedItemOperations(self._client, self._config, self._serialize, self._deserialize) + self.recovery_point = RecoveryPointOperations(self._client, self._config, self._serialize, self._deserialize) self.replication_extension = ReplicationExtensionOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_extension_operation_status = ReplicationExtensionOperationStatusOperations( + self.check_name_availability = CheckNameAvailabilityOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.vault = VaultOperations(self._client, self._config, self._serialize, self._deserialize) - self.vault_operation_status = VaultOperationStatusOperations( + self.deployment_preflight = DeploymentPreflightOperations( self._client, self._config, self._serialize, self._deserialize ) - self.workflow = WorkflowOperations(self._client, self._config, self._serialize, self._deserialize) - self.workflow_operation_status = WorkflowOperationStatusOperations( + self.operation_results = OperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.location_based_operation_results = LocationBasedOperationResultsOperations( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + 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) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -180,13 +209,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + 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) -> "RecoveryServicesDataReplicationMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_configuration.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_configuration.py index 2647c8c368a5..3e1d259e4caa 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_configuration.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_configuration.py @@ -1,44 +1,48 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class RecoveryServicesDataReplicationMgmtClientConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class RecoveryServicesDataReplicationMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for RecoveryServicesDataReplicationMgmtClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :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 - :keyword api_version: Api Version. Default value is "2021-02-16-preview". Note that overriding - this default value may result in unsupported behavior. + :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 "2024-09-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(RecoveryServicesDataReplicationMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2021-02-16-preview") + 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", "2024-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -47,9 +51,11 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k 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-recoveryservicesdatareplication/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -58,9 +64,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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( diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_patch.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_patch.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_vendor.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_vendor.py deleted file mode 100644 index 19394cdd762b..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/_vendor.py +++ /dev/null @@ -1,28 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport import HttpRequest - -from ._configuration import RecoveryServicesDataReplicationMgmtClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class RecoveryServicesDataReplicationMgmtClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: RecoveryServicesDataReplicationMgmtClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/__init__.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/__init__.py index 08f3ec0219c3..5b972d92b8f8 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/__init__.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/__init__.py @@ -2,56 +2,58 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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 ._dra_operations import DraOperations -from ._dra_operation_status_operations import DraOperationStatusOperations -from ._email_configuration_operations import EmailConfigurationOperations -from ._event_operations import EventOperations -from ._fabric_operations import FabricOperations -from ._fabric_operations_status_operations import FabricOperationsStatusOperations -from ._policy_operations import PolicyOperations -from ._policy_operation_status_operations import PolicyOperationStatusOperations -from ._protected_item_operations import ProtectedItemOperations -from ._protected_item_operation_status_operations import ProtectedItemOperationStatusOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._replication_extension_operations import ReplicationExtensionOperations -from ._replication_extension_operation_status_operations import ReplicationExtensionOperationStatusOperations -from ._recovery_services_data_replication_mgmt_client_operations import ( - RecoveryServicesDataReplicationMgmtClientOperationsMixin, -) -from ._operations import Operations -from ._vault_operations import VaultOperations -from ._vault_operation_status_operations import VaultOperationStatusOperations -from ._workflow_operations import WorkflowOperations -from ._workflow_operation_status_operations import WorkflowOperationStatusOperations +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 EmailConfigurationOperations # type: ignore +from ._operations import VaultOperations # type: ignore +from ._operations import EventOperations # type: ignore +from ._operations import FabricOperations # type: ignore +from ._operations import FabricAgentOperations # type: ignore +from ._operations import JobOperations # type: ignore +from ._operations import PolicyOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import PrivateEndpointConnectionProxiesOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import ProtectedItemOperations # type: ignore +from ._operations import RecoveryPointOperations # type: ignore +from ._operations import ReplicationExtensionOperations # type: ignore +from ._operations import CheckNameAvailabilityOperations # type: ignore +from ._operations import DeploymentPreflightOperations # type: ignore +from ._operations import OperationResultsOperations # type: ignore +from ._operations import LocationBasedOperationResultsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "DraOperations", - "DraOperationStatusOperations", + "Operations", "EmailConfigurationOperations", + "VaultOperations", "EventOperations", "FabricOperations", - "FabricOperationsStatusOperations", + "FabricAgentOperations", + "JobOperations", "PolicyOperations", - "PolicyOperationStatusOperations", + "PrivateEndpointConnectionsOperations", + "PrivateEndpointConnectionProxiesOperations", + "PrivateLinkResourcesOperations", "ProtectedItemOperations", - "ProtectedItemOperationStatusOperations", - "RecoveryPointsOperations", + "RecoveryPointOperations", "ReplicationExtensionOperations", - "ReplicationExtensionOperationStatusOperations", - "RecoveryServicesDataReplicationMgmtClientOperationsMixin", - "Operations", - "VaultOperations", - "VaultOperationStatusOperations", - "WorkflowOperations", - "WorkflowOperationStatusOperations", + "CheckNameAvailabilityOperations", + "DeploymentPreflightOperations", + "OperationResultsOperations", + "LocationBasedOperationResultsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_dra_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_dra_operation_status_operations.py deleted file mode 100644 index 99b0411f7874..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_dra_operation_status_operations.py +++ /dev/null @@ -1,125 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._dra_operation_status_operations import build_get_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DraOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`dra_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the fabric agent (Dra) operation status. - - Tracks the results of an asynchronous operation on the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_dra_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_dra_operations.py deleted file mode 100644 index 159eba321204..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_dra_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._dra_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DraOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`dra` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, **kwargs: Any - ) -> _models.DraModel: - """Gets the fabric agent (Dra). - - Gets the details of the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DraModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DraModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DraModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DraModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - async def _create_initial( - self, - resource_group_name: str, - fabric_name: str, - fabric_agent_name: str, - body: Optional[Union[_models.DraModel, IO]] = None, - **kwargs: Any - ) -> _models.DraModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DraModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "DraModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DraModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DraModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - fabric_name: str, - fabric_agent_name: str, - body: Optional[_models.DraModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DraModel]: - """Puts the fabric agent (Dra). - - Creates the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :param body: Dra model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DraModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DraModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - fabric_name: str, - fabric_agent_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DraModel]: - """Puts the fabric agent (Dra). - - Creates the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :param body: Dra model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DraModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - fabric_name: str, - fabric_agent_name: str, - body: Optional[Union[_models.DraModel, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.DraModel]: - """Puts the fabric agent (Dra). - - Creates the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :param body: Dra model. Is either a DraModel type or a IO type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DraModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DraModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DraModel] = 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, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DraModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes the fabric agent (Dra). - - Deletes the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - @distributed_trace - def list(self, resource_group_name: str, fabric_name: str, **kwargs: Any) -> AsyncIterable["_models.DraModel"]: - """Lists the fabric agents (Dras). - - Gets the list of fabric agents in the given fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DraModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DraModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DraModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_email_configuration_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_email_configuration_operations.py deleted file mode 100644 index bcbfdc655e7d..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_email_configuration_operations.py +++ /dev/null @@ -1,388 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._email_configuration_operations import build_create_request, build_get_request, build_list_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EmailConfigurationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`email_configuration` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, email_configuration_name: str, **kwargs: Any - ) -> _models.EmailConfigurationModel: - """Gets the email configuration setting. - - Gets the details of the alert configuration setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param email_configuration_name: The email configuration name. Required. - :type email_configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmailConfigurationModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EmailConfigurationModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - email_configuration_name=email_configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EmailConfigurationModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" - } - - @overload - async def create( - self, - resource_group_name: str, - vault_name: str, - email_configuration_name: str, - body: Optional[_models.EmailConfigurationModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EmailConfigurationModel: - """Creates email configuration settings. - - Creates an alert configuration setting for the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param email_configuration_name: The email configuration name. Required. - :type email_configuration_name: str - :param body: EmailConfiguration model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmailConfigurationModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - vault_name: str, - email_configuration_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EmailConfigurationModel: - """Creates email configuration settings. - - Creates an alert configuration setting for the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param email_configuration_name: The email configuration name. Required. - :type email_configuration_name: str - :param body: EmailConfiguration model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmailConfigurationModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - vault_name: str, - email_configuration_name: str, - body: Optional[Union[_models.EmailConfigurationModel, IO]] = None, - **kwargs: Any - ) -> _models.EmailConfigurationModel: - """Creates email configuration settings. - - Creates an alert configuration setting for the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param email_configuration_name: The email configuration name. Required. - :type email_configuration_name: str - :param body: EmailConfiguration model. Is either a EmailConfigurationModel type or a IO type. - Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmailConfigurationModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EmailConfigurationModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "EmailConfigurationModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - email_configuration_name=email_configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("EmailConfigurationModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EmailConfigurationModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.EmailConfigurationModel"]: - """Lists the email configuration settings. - - Gets the list of alert configuration settings for the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EmailConfigurationModel or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EmailConfigurationModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("EmailConfigurationModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_event_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_event_operations.py deleted file mode 100644 index 28eefb8c6b29..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_event_operations.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._event_operations import build_get_request, build_list_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EventOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`event` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, event_name: str, **kwargs: Any - ) -> _models.EventModel: - """Gets the event. - - Gets the details of the event. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param event_name: The event name. Required. - :type event_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EventModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EventModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EventModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - event_name=event_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EventModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}" - } - - @distributed_trace - def list( - self, - resource_group_name: str, - vault_name: str, - filter: Optional[str] = None, - continuation_token_parameter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.EventModel"]: - """Lists the events. - - Gets the list of events in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param filter: Filter string. Default value is None. - :type filter: str - :param continuation_token_parameter: Continuation token. Default value is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.EventModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EventModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - filter=filter, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("EventModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_fabric_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_fabric_operations.py deleted file mode 100644 index e30be8684020..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_fabric_operations.py +++ /dev/null @@ -1,926 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._fabric_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_subscription_request, - build_list_request, - build_update_request, -) -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FabricOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`fabric` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_group_name: str, fabric_name: str, **kwargs: Any) -> _models.FabricModel: - """Gets the fabric. - - Gets the details of the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: FabricModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FabricModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FabricModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - async def _create_initial( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[Union[_models.FabricModel, IO]] = None, - **kwargs: Any - ) -> _models.FabricModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FabricModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "FabricModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("FabricModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FabricModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[_models.FabricModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FabricModel]: - """Puts the fabric. - - Creates the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FabricModel]: - """Puts the fabric. - - Creates the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[Union[_models.FabricModel, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FabricModel]: - """Puts the fabric. - - Creates the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Is either a FabricModel type or a IO type. Default value is - None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FabricModel] = 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, - fabric_name=fabric_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FabricModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - async def _update_initial( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[Union[_models.FabricModelUpdate, IO]] = None, - **kwargs: Any - ) -> Optional[_models.FabricModel]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FabricModel]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "FabricModelUpdate") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("FabricModel", pipeline_response) - - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[_models.FabricModelUpdate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FabricModel]: - """Updates the fabric. - - Performs update on the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FabricModel]: - """Updates the fabric. - - Performs update on the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[Union[_models.FabricModelUpdate, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FabricModel]: - """Updates the fabric. - - Performs update on the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Is either a FabricModelUpdate type or a IO type. Default value - is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FabricModel] = 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, - fabric_name=fabric_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FabricModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, fabric_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes the fabric. - - Removes the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - fabric_name=fabric_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - @distributed_trace - def list_by_subscription( - self, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.FabricModel"]: - """Lists the fabrics. - - Gets the list of fabrics in the given subscription. - - :param continuation_token_parameter: Continuation token from the previous call. Default value - is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FabricModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FabricModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FabricModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics" - } - - @distributed_trace - def list( - self, resource_group_name: str, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.FabricModel"]: - """Lists the fabrics. - - Gets the list of fabrics in the given subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param continuation_token_parameter: Continuation token from the previous call. Default value - is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FabricModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FabricModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FabricModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_fabric_operations_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_fabric_operations_status_operations.py deleted file mode 100644 index a8b6a54f0e07..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_fabric_operations_status_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._fabric_operations_status_operations import build_get_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FabricOperationsStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`fabric_operations_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, fabric_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the fabric operation status. - - Tracks the results of an asynchronous operation on the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_operations.py index e01988b7520d..9c02e31b2189 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_operations.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_operations.py @@ -1,14 +1,18 @@ -# pylint: disable=too-many-lines +# 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) AutoRest Code Generator. +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +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, @@ -16,22 +20,84 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request -from ...operations._operations import build_list_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_check_name_availability_post_request, + build_deployment_preflight_post_request, + build_email_configuration_create_request, + build_email_configuration_get_request, + build_email_configuration_list_request, + build_event_get_request, + build_event_list_request, + build_fabric_agent_create_request, + build_fabric_agent_delete_request, + build_fabric_agent_get_request, + build_fabric_agent_list_request, + build_fabric_create_request, + build_fabric_delete_request, + build_fabric_get_request, + build_fabric_list_by_subscription_request, + build_fabric_list_request, + build_fabric_update_request, + build_job_get_request, + build_job_list_request, + build_location_based_operation_results_get_request, + build_operation_results_get_request, + build_operations_list_request, + build_policy_create_request, + build_policy_delete_request, + build_policy_get_request, + build_policy_list_request, + build_private_endpoint_connection_proxies_create_request, + build_private_endpoint_connection_proxies_delete_request, + build_private_endpoint_connection_proxies_get_request, + build_private_endpoint_connection_proxies_list_request, + build_private_endpoint_connection_proxies_validate_request, + build_private_endpoint_connections_delete_request, + build_private_endpoint_connections_get_request, + build_private_endpoint_connections_list_request, + build_private_endpoint_connections_update_request, + build_private_link_resources_get_request, + build_private_link_resources_list_request, + build_protected_item_create_request, + build_protected_item_delete_request, + build_protected_item_get_request, + build_protected_item_list_request, + build_protected_item_planned_failover_request, + build_protected_item_update_request, + build_recovery_point_get_request, + build_recovery_point_list_request, + build_replication_extension_create_request, + build_replication_extension_delete_request, + build_replication_extension_get_request, + build_replication_extension_list_request, + build_vault_create_request, + build_vault_delete_request, + build_vault_get_request, + build_vault_list_by_subscription_request, + build_vault_list_request, + build_vault_update_request, +) +from .._configuration import RecoveryServicesDataReplicationMgmtClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] class Operations: @@ -44,34 +110,392 @@ class Operations: :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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"]: - """Get a list of REST API operations supported by Microsoft.DataReplication. - - Gets the operations. + """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) 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 EmailConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`email_configuration` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, email_configuration_name: str, **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Gets the details of the alert configuration setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :return: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :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.EmailConfigurationModel] = kwargs.pop("cls", None) + + _request = build_email_configuration_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + email_configuration_name=email_configuration_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.EmailConfigurationModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + vault_name: str, + email_configuration_name: str, + resource: _models.EmailConfigurationModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Creates an alert configuration setting for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :param resource: EmailConfiguration model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + vault_name: str, + email_configuration_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Creates an alert configuration setting for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :param resource: EmailConfiguration model. 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: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + vault_name: str, + email_configuration_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Creates an alert configuration setting for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :param resource: EmailConfiguration model. 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: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + vault_name: str, + email_configuration_name: str, + resource: Union[_models.EmailConfigurationModel, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Creates an alert configuration setting for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :param resource: EmailConfiguration model. Is one of the following types: + EmailConfigurationModel, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel or + JSON or IO[bytes] + :return: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :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.EmailConfigurationModel] = 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_email_configuration_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + email_configuration_name=email_configuration_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 = 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, 201]: + 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.EmailConfigurationModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncIterable["_models.EmailConfigurationModel"]: + """Gets the list of alert configuration settings for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of EmailConfigurationModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.EmailConfigurationModel]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,14 +506,20 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], + _request = build_email_configuration_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + 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 @@ -101,37 +531,7026 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + 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 = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.EmailConfigurationModel], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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) - list.metadata = {"url": "/providers/Microsoft.DataReplication/operations"} + +class VaultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`vault` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, **kwargs: Any) -> _models.VaultModel: + """Gets the details of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: VaultModel. The VaultModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel + :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.VaultModel] = kwargs.pop("cls", None) + + _request = build_vault_get_request( + resource_group_name=resource_group_name, + vault_name=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.VaultModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + vault_name: str, + resource: Union[_models.VaultModel, 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_vault_create_request( + resource_group_name=resource_group_name, + vault_name=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, + vault_name: str, + resource: _models.VaultModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultModel]: + """Creates the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param resource: Vault properties. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel + :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 VaultModel. The VaultModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultModel]: + """Creates the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param resource: Vault properties. 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 VaultModel. The VaultModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultModel]: + """Creates the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param resource: Vault properties. 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 VaultModel. The VaultModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + resource: Union[_models.VaultModel, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultModel]: + """Creates the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param resource: Vault properties. Is one of the following types: VaultModel, JSON, IO[bytes] + Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns VaultModel. The VaultModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :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.VaultModel] = 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, + vault_name=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.VaultModel, 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.VaultModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VaultModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + vault_name: str, + properties: Union[_models.VaultModelUpdate, 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_vault_update_request( + resource_group_name=resource_group_name, + vault_name=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, + vault_name: str, + properties: _models.VaultModelUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultModel]: + """Performs update on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param properties: Vault properties. Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdate + :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 VaultModel. The VaultModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultModel]: + """Performs update on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param properties: Vault properties. 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 VaultModel. The VaultModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultModel]: + """Performs update on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param properties: Vault properties. 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 VaultModel. The VaultModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + properties: Union[_models.VaultModelUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultModel]: + """Performs update on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param properties: Vault properties. Is one of the following types: VaultModelUpdate, JSON, + IO[bytes] Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdate or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns VaultModel. The VaultModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :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.VaultModel] = 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, + vault_name=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.VaultModel, 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.VaultModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VaultModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, 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_vault_delete_request( + resource_group_name=resource_group_name, + vault_name=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 + async def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Removes the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type 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, + vault_name=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 + def list( + self, resource_group_name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.VaultModel"]: + """Gets the list of vaults in the given subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword continuation_token_parameter: Continuation token from the previous call. Default value + is None. + :paramtype continuation_token_parameter: str + :return: An iterator like instance of VaultModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VaultModel]] = 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_vault_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + continuation_token_parameter=continuation_token_parameter, + 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.VaultModel], 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 + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VaultModel"]: + """Gets the list of vaults in the given subscription. + + :return: An iterator like instance of VaultModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VaultModel]] = 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_vault_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.VaultModel], 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 EventOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`event` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, event_name: str, **kwargs: Any + ) -> _models.EventModel: + """Gets the details of the event. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param event_name: The event name. Required. + :type event_name: str + :return: EventModel. The EventModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EventModel + :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.EventModel] = kwargs.pop("cls", None) + + _request = build_event_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + event_name=event_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.EventModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + *, + odata_options: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EventModel"]: + """Gets the list of events in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :keyword odata_options: OData options. Default value is None. + :paramtype odata_options: str + :keyword continuation_token_parameter: Continuation token. Default value is None. + :paramtype continuation_token_parameter: str + :keyword page_size: Page size. Default value is None. + :paramtype page_size: int + :return: An iterator like instance of EventModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.EventModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EventModel]] = 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_event_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + odata_options=odata_options, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + 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.EventModel], 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 FabricOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`fabric` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, fabric_name: str, **kwargs: Any) -> _models.FabricModel: + """Gets the details of the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :return: FabricModel. The FabricModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel + :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.FabricModel] = kwargs.pop("cls", None) + + _request = build_fabric_get_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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.FabricModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + fabric_name: str, + resource: Union[_models.FabricModel, 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_fabric_create_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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, + fabric_name: str, + resource: _models.FabricModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricModel]: + """Creates the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param resource: Fabric properties. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel + :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 FabricModel. The FabricModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + fabric_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricModel]: + """Creates the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param resource: Fabric properties. 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 FabricModel. The FabricModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + fabric_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricModel]: + """Creates the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param resource: Fabric properties. 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 FabricModel. The FabricModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + fabric_name: str, + resource: Union[_models.FabricModel, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricModel]: + """Creates the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param resource: Fabric properties. Is one of the following types: FabricModel, JSON, IO[bytes] + Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns FabricModel. The FabricModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :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.FabricModel] = 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, + fabric_name=fabric_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.FabricModel, 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.FabricModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FabricModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + fabric_name: str, + properties: Union[_models.FabricModelUpdate, 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_fabric_update_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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, + fabric_name: str, + properties: _models.FabricModelUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricModel]: + """Performs update on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param properties: Fabric properties. Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdate + :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 FabricModel. The FabricModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + fabric_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricModel]: + """Performs update on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param properties: Fabric properties. 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 FabricModel. The FabricModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + fabric_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricModel]: + """Performs update on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param properties: Fabric properties. 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 FabricModel. The FabricModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + fabric_name: str, + properties: Union[_models.FabricModelUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricModel]: + """Performs update on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param properties: Fabric properties. Is one of the following types: FabricModelUpdate, JSON, + IO[bytes] Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdate or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns FabricModel. The FabricModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :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.FabricModel] = 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, + fabric_name=fabric_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.FabricModel, 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.FabricModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FabricModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, fabric_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_fabric_delete_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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 + async def begin_delete(self, resource_group_name: str, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Removes the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_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, + fabric_name=fabric_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 + def list( + self, resource_group_name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.FabricModel"]: + """Gets the list of fabrics in the given subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword continuation_token_parameter: Continuation token from the previous call. Default value + is None. + :paramtype continuation_token_parameter: str + :return: An iterator like instance of FabricModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FabricModel]] = 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_fabric_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + continuation_token_parameter=continuation_token_parameter, + 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.FabricModel], 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 + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.FabricModel"]: + """Gets the list of fabrics in the given subscription. + + :return: An iterator like instance of FabricModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FabricModel]] = 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_fabric_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.FabricModel], 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 FabricAgentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`fabric_agent` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, fabric_name: str, fabric_agent_name: str, **kwargs: Any + ) -> _models.FabricAgentModel: + """Gets the details of the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :return: FabricAgentModel. The FabricAgentModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel + :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.FabricAgentModel] = kwargs.pop("cls", None) + + _request = build_fabric_agent_get_request( + resource_group_name=resource_group_name, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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.FabricAgentModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + fabric_name: str, + fabric_agent_name: str, + resource: Union[_models.FabricAgentModel, 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_fabric_agent_create_request( + resource_group_name=resource_group_name, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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, + fabric_name: str, + fabric_agent_name: str, + resource: _models.FabricAgentModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricAgentModel]: + """Creates the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :param resource: Fabric agent model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel + :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 FabricAgentModel. The FabricAgentModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + fabric_name: str, + fabric_agent_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricAgentModel]: + """Creates the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :param resource: Fabric agent model. 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 FabricAgentModel. The FabricAgentModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + fabric_name: str, + fabric_agent_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricAgentModel]: + """Creates the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :param resource: Fabric agent model. 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 FabricAgentModel. The FabricAgentModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + fabric_name: str, + fabric_agent_name: str, + resource: Union[_models.FabricAgentModel, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FabricAgentModel]: + """Creates the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :param resource: Fabric agent model. Is one of the following types: FabricAgentModel, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns FabricAgentModel. The FabricAgentModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :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.FabricAgentModel] = 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, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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.FabricAgentModel, 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.FabricAgentModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FabricAgentModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, fabric_name: str, fabric_agent_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_fabric_agent_delete_request( + resource_group_name=resource_group_name, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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 + async def begin_delete( + self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_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, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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 + def list( + self, resource_group_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FabricAgentModel"]: + """Gets the list of fabric agents in the given fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of FabricAgentModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FabricAgentModel]] = 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_fabric_agent_list_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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.FabricAgentModel], 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 JobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`job` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, job_name: str, **kwargs: Any) -> _models.JobModel: + """Gets the details of the job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param job_name: The job name. Required. + :type job_name: str + :return: JobModel. The JobModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.JobModel + :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.JobModel] = kwargs.pop("cls", None) + + _request = build_job_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + job_name=job_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.JobModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + *, + odata_options: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.JobModel"]: + """Gets the list of jobs in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :keyword odata_options: OData options. Default value is None. + :paramtype odata_options: str + :keyword continuation_token_parameter: Continuation token. Default value is None. + :paramtype continuation_token_parameter: str + :keyword page_size: Page size. Default value is None. + :paramtype page_size: int + :return: An iterator like instance of JobModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.JobModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobModel]] = 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_job_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + odata_options=odata_options, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + 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.JobModel], 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 PolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`policy` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, policy_name: str, **kwargs: Any + ) -> _models.PolicyModel: + """Gets the details of the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :return: PolicyModel. The PolicyModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel + :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.PolicyModel] = kwargs.pop("cls", None) + + _request = build_policy_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + policy_name=policy_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.PolicyModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + vault_name: str, + policy_name: str, + resource: Union[_models.PolicyModel, 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_policy_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + policy_name=policy_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, + vault_name: str, + policy_name: str, + resource: _models.PolicyModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PolicyModel]: + """Creates the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :param resource: Policy model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel + :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 PolicyModel. The PolicyModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + policy_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PolicyModel]: + """Creates the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :param resource: Policy model. 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 PolicyModel. The PolicyModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + policy_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PolicyModel]: + """Creates the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :param resource: Policy model. 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 PolicyModel. The PolicyModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + policy_name: str, + resource: Union[_models.PolicyModel, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PolicyModel]: + """Creates the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :param resource: Policy model. Is one of the following types: PolicyModel, JSON, IO[bytes] + Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns PolicyModel. The PolicyModel is compatible + with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :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.PolicyModel] = 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, + vault_name=vault_name, + policy_name=policy_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.PolicyModel, 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.PolicyModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PolicyModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, vault_name: str, policy_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_policy_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + policy_name=policy_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 + async def begin_delete( + self, resource_group_name: str, vault_name: str, policy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Removes the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_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, + vault_name=vault_name, + policy_name=policy_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 + def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncIterable["_models.PolicyModel"]: + """Gets the list of policies in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of PolicyModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PolicyModel]] = 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_policy_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.PolicyModel], 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 PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`private_endpoint_connections` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the private endpoint connection details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :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.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_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.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updated the private endpoint connection status (Approval/Rejected). This gets invoked by + resource admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param resource: Private endpoint connection update input. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updated the private endpoint connection status (Approval/Rejected). This gets invoked by + resource admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param resource: Private endpoint connection update input. 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: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updated the private endpoint connection status (Approval/Rejected). This gets invoked by + resource admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param resource: Private endpoint connection update input. 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: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updated the private endpoint connection status (Approval/Rejected). This gets invoked by + resource admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param resource: Private endpoint connection update input. Is one of the following types: + PrivateEndpointConnection, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection or + JSON or IO[bytes] + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :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.PrivateEndpointConnection] = 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_private_endpoint_connections_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_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 = 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, 201]: + 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.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_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_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_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 + async def begin_delete( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_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, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_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 + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """Gets the all private endpoint connections configured on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = 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_private_endpoint_connections_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.PrivateEndpointConnection], 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 PrivateEndpointConnectionProxiesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`private_endpoint_connection_proxies` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, private_endpoint_connection_proxy_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Gets the private endpoint connection proxy details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :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.PrivateEndpointConnectionProxy] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connection_proxies_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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.PrivateEndpointConnectionProxy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + resource: _models.PrivateEndpointConnectionProxy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Create a new private endpoint connection proxy which includes both auto and manual approval + types. Creating the proxy resource will also create a private endpoint connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param resource: Private endpoint connection creation input. Required. + :type resource: + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Create a new private endpoint connection proxy which includes both auto and manual approval + types. Creating the proxy resource will also create a private endpoint connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param resource: Private endpoint connection creation input. 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: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Create a new private endpoint connection proxy which includes both auto and manual approval + types. Creating the proxy resource will also create a private endpoint connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param resource: Private endpoint connection creation input. 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: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + resource: Union[_models.PrivateEndpointConnectionProxy, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Create a new private endpoint connection proxy which includes both auto and manual approval + types. Creating the proxy resource will also create a private endpoint connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param resource: Private endpoint connection creation input. Is one of the following types: + PrivateEndpointConnectionProxy, JSON, IO[bytes] Required. + :type resource: + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy or JSON or + IO[bytes] + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :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.PrivateEndpointConnectionProxy] = 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_private_endpoint_connection_proxies_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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 = 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, 201]: + 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.PrivateEndpointConnectionProxy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_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_private_endpoint_connection_proxies_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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 + async def begin_delete( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Returns the operation to track the deletion of private endpoint connection proxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_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, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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 + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionProxy"]: + """Gets the all private endpoint connections proxies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of PrivateEndpointConnectionProxy + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnectionProxy]] = 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_private_endpoint_connection_proxies_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.PrivateEndpointConnectionProxy], 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) + + @overload + async def validate( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + body: _models.PrivateEndpointConnectionProxy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Returns remote private endpoint connection information after validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param body: The private endpoint connection proxy input. Required. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Returns remote private endpoint connection information after validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param body: The private endpoint connection proxy input. 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: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Returns remote private endpoint connection information after validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param body: The private endpoint connection proxy input. 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: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + body: Union[_models.PrivateEndpointConnectionProxy, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Returns remote private endpoint connection information after validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param body: The private endpoint connection proxy input. Is one of the following types: + PrivateEndpointConnectionProxy, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + or JSON or IO[bytes] + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :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.PrivateEndpointConnectionProxy] = 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_private_endpoint_connection_proxies_validate_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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 = 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.PrivateEndpointConnectionProxy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`private_link_resources` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, private_link_resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the details of site recovery private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_link_resource_name: The private link name. Required. + :type private_link_resource_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkResource + :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.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_private_link_resources_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_link_resource_name=private_link_resource_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.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: + """Gets the list of private link resources. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = 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_private_link_resources_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.PrivateLinkResource], 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 ProtectedItemOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`protected_item` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, protected_item_name: str, **kwargs: Any + ) -> _models.ProtectedItemModel: + """Gets the details of the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :return: ProtectedItemModel. The ProtectedItemModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel + :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.ProtectedItemModel] = kwargs.pop("cls", None) + + _request = build_protected_item_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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.ProtectedItemModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + resource: Union[_models.ProtectedItemModel, 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_protected_item_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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, + vault_name: str, + protected_item_name: str, + resource: _models.ProtectedItemModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectedItemModel]: + """Creates the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param resource: Protected item model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel + :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 ProtectedItemModel. The ProtectedItemModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectedItemModel]: + """Creates the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param resource: Protected item model. 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 ProtectedItemModel. The ProtectedItemModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectedItemModel]: + """Creates the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param resource: Protected item model. 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 ProtectedItemModel. The ProtectedItemModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + resource: Union[_models.ProtectedItemModel, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectedItemModel]: + """Creates the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param resource: Protected item model. Is one of the following types: ProtectedItemModel, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns ProtectedItemModel. The ProtectedItemModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :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.ProtectedItemModel] = 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, + vault_name=vault_name, + protected_item_name=protected_item_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.ProtectedItemModel, 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.ProtectedItemModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ProtectedItemModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + properties: Union[_models.ProtectedItemModelUpdate, 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_protected_item_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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, + vault_name: str, + protected_item_name: str, + properties: _models.ProtectedItemModelUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectedItemModel]: + """Performs update on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param properties: Protected item model. Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelUpdate + :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 ProtectedItemModel. The ProtectedItemModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectedItemModel]: + """Performs update on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param properties: Protected item model. 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 ProtectedItemModel. The ProtectedItemModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectedItemModel]: + """Performs update on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param properties: Protected item model. 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 ProtectedItemModel. The ProtectedItemModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + properties: Union[_models.ProtectedItemModelUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectedItemModel]: + """Performs update on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param properties: Protected item model. Is one of the following types: + ProtectedItemModelUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelUpdate + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ProtectedItemModel. The ProtectedItemModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :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.ProtectedItemModel] = 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, + vault_name=vault_name, + protected_item_name=protected_item_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.ProtectedItemModel, 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.ProtectedItemModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ProtectedItemModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + *, + force_delete: Optional[bool] = None, + **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_protected_item_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, + force_delete=force_delete, + 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, + vault_name: str, + protected_item_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Removes the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :keyword force_delete: A flag indicating whether to do force delete or not. Default value is + None. + :paramtype force_delete: bool + :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, + vault_name=vault_name, + protected_item_name=protected_item_name, + force_delete=force_delete, + 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( + self, + resource_group_name: str, + vault_name: str, + *, + odata_options: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ProtectedItemModel"]: + """Gets the list of protected items in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :keyword odata_options: OData options. Default value is None. + :paramtype odata_options: str + :keyword continuation_token_parameter: Continuation token. Default value is None. + :paramtype continuation_token_parameter: str + :keyword page_size: Page size. Default value is None. + :paramtype page_size: int + :return: An iterator like instance of ProtectedItemModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectedItemModel]] = 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_protected_item_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + odata_options=odata_options, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + 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.ProtectedItemModel], 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 _planned_failover_initial( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: Union[_models.PlannedFailoverModel, 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_protected_item_planned_failover_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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_planned_failover( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: _models.PlannedFailoverModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PlannedFailoverModel]: + """Performs the planned failover on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param body: Planned failover model. Required. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel + :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 PlannedFailoverModel. The + PlannedFailoverModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_planned_failover( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PlannedFailoverModel]: + """Performs the planned failover on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param body: Planned failover model. 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 PlannedFailoverModel. The + PlannedFailoverModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_planned_failover( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PlannedFailoverModel]: + """Performs the planned failover on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param body: Planned failover model. 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 PlannedFailoverModel. The + PlannedFailoverModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_planned_failover( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: Union[_models.PlannedFailoverModel, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PlannedFailoverModel]: + """Performs the planned failover on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param body: Planned failover model. Is one of the following types: PlannedFailoverModel, JSON, + IO[bytes] Required. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns PlannedFailoverModel. The + PlannedFailoverModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] + :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.PlannedFailoverModel] = 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._planned_failover_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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.PlannedFailoverModel, 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.PlannedFailoverModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PlannedFailoverModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class RecoveryPointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`recovery_point` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, + vault_name: str, + protected_item_name: str, + recovery_point_name: str, + **kwargs: Any + ) -> _models.RecoveryPointModel: + """Gets the details of the recovery point of a protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param recovery_point_name: The recovery point name. Required. + :type recovery_point_name: str + :return: RecoveryPointModel. The RecoveryPointModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel + :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.RecoveryPointModel] = kwargs.pop("cls", None) + + _request = build_recovery_point_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_name, + recovery_point_name=recovery_point_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.RecoveryPointModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, protected_item_name: str, **kwargs: Any + ) -> AsyncIterable["_models.RecoveryPointModel"]: + """Gets the list of recovery points of the given protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :return: An iterator like instance of RecoveryPointModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryPointModel]] = 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_recovery_point_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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.RecoveryPointModel], 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 ReplicationExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`replication_extension` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, replication_extension_name: str, **kwargs: Any + ) -> _models.ReplicationExtensionModel: + """Gets the details of the replication extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :return: ReplicationExtensionModel. The ReplicationExtensionModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel + :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.ReplicationExtensionModel] = kwargs.pop("cls", None) + + _request = build_replication_extension_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + replication_extension_name=replication_extension_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.ReplicationExtensionModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + vault_name: str, + replication_extension_name: str, + resource: Union[_models.ReplicationExtensionModel, 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_replication_extension_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + replication_extension_name=replication_extension_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, + vault_name: str, + replication_extension_name: str, + resource: _models.ReplicationExtensionModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationExtensionModel]: + """Creates the replication extension in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :param resource: Replication extension model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel + :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 ReplicationExtensionModel. The + ReplicationExtensionModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + replication_extension_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationExtensionModel]: + """Creates the replication extension in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :param resource: Replication extension model. 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 ReplicationExtensionModel. The + ReplicationExtensionModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + replication_extension_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationExtensionModel]: + """Creates the replication extension in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :param resource: Replication extension model. 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 ReplicationExtensionModel. The + ReplicationExtensionModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + vault_name: str, + replication_extension_name: str, + resource: Union[_models.ReplicationExtensionModel, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationExtensionModel]: + """Creates the replication extension in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :param resource: Replication extension model. Is one of the following types: + ReplicationExtensionModel, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationExtensionModel. The + ReplicationExtensionModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] + :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.ReplicationExtensionModel] = 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, + vault_name=vault_name, + replication_extension_name=replication_extension_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.ReplicationExtensionModel, 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.ReplicationExtensionModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationExtensionModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, vault_name: str, replication_extension_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_replication_extension_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + replication_extension_name=replication_extension_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 + async def begin_delete( + self, resource_group_name: str, vault_name: str, replication_extension_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the replication extension in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_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, + vault_name=vault_name, + replication_extension_name=replication_extension_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 + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ReplicationExtensionModel"]: + """Gets the list of replication extensions in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of ReplicationExtensionModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationExtensionModel]] = 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_replication_extension_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.ReplicationExtensionModel], 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 CheckNameAvailabilityOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`check_name_availability` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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") + + @overload + async def post( + self, + location: str, + body: Optional[_models.CheckNameAvailabilityModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseModel: + """Performs the resource name availability check. + + Checks the resource name availability. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: Resource details. Default value is None. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResponseModel. The CheckNameAvailabilityResponseModel is + compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, location: str, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseModel: + """Performs the resource name availability check. + + Checks the resource name availability. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: Resource details. Default value is None. + :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: CheckNameAvailabilityResponseModel. The CheckNameAvailabilityResponseModel is + compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, location: str, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseModel: + """Performs the resource name availability check. + + Checks the resource name availability. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: Resource details. Default value is None. + :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: CheckNameAvailabilityResponseModel. The CheckNameAvailabilityResponseModel is + compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def post( + self, + location: str, + body: Optional[Union[_models.CheckNameAvailabilityModel, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseModel: + """Performs the resource name availability check. + + Checks the resource name availability. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: Resource details. Is one of the following types: CheckNameAvailabilityModel, JSON, + IO[bytes] Default value is None. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityModel or + JSON or IO[bytes] + :return: CheckNameAvailabilityResponseModel. The CheckNameAvailabilityResponseModel is + compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel + :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.CheckNameAvailabilityResponseModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_check_name_availability_post_request( + location=location, + 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.CheckNameAvailabilityResponseModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DeploymentPreflightOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`deployment_preflight` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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") + + @overload + async def post( + self, + resource_group_name: str, + deployment_id: str, + body: Optional[_models.DeploymentPreflightModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeploymentPreflightModel: + """Performs resource deployment validation. + + Performs resource deployment preflight validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_id: Deployment Id. Required. + :type deployment_id: str + :param body: Deployment preflight model. Default value is None. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DeploymentPreflightModel. The DeploymentPreflightModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + deployment_id: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeploymentPreflightModel: + """Performs resource deployment validation. + + Performs resource deployment preflight validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_id: Deployment Id. Required. + :type deployment_id: str + :param body: Deployment preflight model. Default value is None. + :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: DeploymentPreflightModel. The DeploymentPreflightModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + deployment_id: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeploymentPreflightModel: + """Performs resource deployment validation. + + Performs resource deployment preflight validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_id: Deployment Id. Required. + :type deployment_id: str + :param body: Deployment preflight model. Default value is None. + :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: DeploymentPreflightModel. The DeploymentPreflightModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + deployment_id: str, + body: Optional[Union[_models.DeploymentPreflightModel, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DeploymentPreflightModel: + """Performs resource deployment validation. + + Performs resource deployment preflight validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_id: Deployment Id. Required. + :type deployment_id: str + :param body: Deployment preflight model. Is one of the following types: + DeploymentPreflightModel, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel or JSON + or IO[bytes] + :return: DeploymentPreflightModel. The DeploymentPreflightModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :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.DeploymentPreflightModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_deployment_preflight_post_request( + resource_group_name=resource_group_name, + deployment_id=deployment_id, + 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.DeploymentPreflightModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`operation_results` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, operation_id: str, **kwargs: Any) -> _models.OperationStatus: + """Gets the operation result status. + + Gets the operations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :return: OperationStatus. The OperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus + :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.OperationStatus] = kwargs.pop("cls", None) + + _request = build_operation_results_get_request( + resource_group_name=resource_group_name, + operation_id=operation_id, + 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.OperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class LocationBasedOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`location_based_operation_results` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, location: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: + """Gets the location based operation result status. + + Gets the location based operation result. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :return: OperationStatus. The OperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus + :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.OperationStatus] = kwargs.pop("cls", None) + + _request = build_location_based_operation_results_get_request( + resource_group_name=resource_group_name, + location=location, + operation_id=operation_id, + 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.OperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_patch.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_patch.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_policy_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_policy_operation_status_operations.py deleted file mode 100644 index 2b4d56303f6c..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_policy_operation_status_operations.py +++ /dev/null @@ -1,125 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._policy_operation_status_operations import build_get_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PolicyOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`policy_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, policy_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the policy operation status. - - Tracks the results of an asynchronous operation on the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_policy_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_policy_operations.py deleted file mode 100644 index 86416da04dff..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_policy_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._policy_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PolicyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`policy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, policy_name: str, **kwargs: Any - ) -> _models.PolicyModel: - """Gets the policy. - - Gets the details of the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PolicyModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PolicyModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PolicyModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - async def _create_initial( - self, - resource_group_name: str, - vault_name: str, - policy_name: str, - body: Optional[Union[_models.PolicyModel, IO]] = None, - **kwargs: Any - ) -> _models.PolicyModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PolicyModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "PolicyModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PolicyModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PolicyModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - policy_name: str, - body: Optional[_models.PolicyModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PolicyModel]: - """Puts the policy. - - Creates the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :param body: Policy model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PolicyModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - policy_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PolicyModel]: - """Puts the policy. - - Creates the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :param body: Policy model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PolicyModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - policy_name: str, - body: Optional[Union[_models.PolicyModel, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.PolicyModel]: - """Puts the policy. - - Creates the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :param body: Policy model. Is either a PolicyModel type or a IO type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PolicyModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PolicyModel] = 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, - vault_name=vault_name, - policy_name=policy_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PolicyModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, policy_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vault_name: str, policy_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes the policy. - - Removes the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - @distributed_trace - def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncIterable["_models.PolicyModel"]: - """Lists the policies. - - Gets the list of policies in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PolicyModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PolicyModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PolicyModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_protected_item_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_protected_item_operation_status_operations.py deleted file mode 100644 index 02a64e0f98dc..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_protected_item_operation_status_operations.py +++ /dev/null @@ -1,125 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._protected_item_operation_status_operations import build_get_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ProtectedItemOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`protected_item_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, protected_item_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the protected item operation status. - - Tracks the results of an asynchronous operation on the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_protected_item_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_protected_item_operations.py deleted file mode 100644 index 686a4f75940f..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_protected_item_operations.py +++ /dev/null @@ -1,882 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._protected_item_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_planned_failover_request, -) -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ProtectedItemOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`protected_item` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, protected_item_name: str, **kwargs: Any - ) -> _models.ProtectedItemModel: - """Gets the protected item. - - Gets the details of the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectedItemModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ProtectedItemModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProtectedItemModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - async def _create_initial( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[Union[_models.ProtectedItemModel, IO]] = None, - **kwargs: Any - ) -> _models.ProtectedItemModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProtectedItemModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ProtectedItemModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ProtectedItemModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProtectedItemModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[_models.ProtectedItemModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectedItemModel]: - """Puts the protected item. - - Creates the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Protected item model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProtectedItemModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectedItemModel]: - """Puts the protected item. - - Creates the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Protected item model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProtectedItemModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[Union[_models.ProtectedItemModel, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectedItemModel]: - """Puts the protected item. - - Creates the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Protected item model. Is either a ProtectedItemModel type or a IO type. Default - value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProtectedItemModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProtectedItemModel] = 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, - vault_name=vault_name, - protected_item_name=protected_item_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ProtectedItemModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - force_delete: Optional[bool] = None, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - force_delete=force_delete, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - force_delete: Optional[bool] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes the protected item. - - Removes the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param force_delete: A flag indicating whether to do force delete or not. Default value is - None. - :type force_delete: bool - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - force_delete=force_delete, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ProtectedItemModel"]: - """Lists the protected items. - - Gets the list of protected items in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectedItemModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ProtectedItemModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ProtectedItemModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems" - } - - async def _planned_failover_initial( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[Union[_models.PlannedFailoverModel, IO]] = None, - **kwargs: Any - ) -> Optional[_models.PlannedFailoverModel]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PlannedFailoverModel]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "PlannedFailoverModel") - else: - _json = None - - request = build_planned_failover_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._planned_failover_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("PlannedFailoverModel", pipeline_response) - - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _planned_failover_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" - } - - @overload - async def begin_planned_failover( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[_models.PlannedFailoverModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PlannedFailoverModel]: - """Performs planned failover. - - Performs the planned failover on the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Planned failover model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PlannedFailoverModel or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_planned_failover( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PlannedFailoverModel]: - """Performs planned failover. - - Performs the planned failover on the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Planned failover model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PlannedFailoverModel or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_planned_failover( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[Union[_models.PlannedFailoverModel, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.PlannedFailoverModel]: - """Performs planned failover. - - Performs the planned failover on the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Planned failover model. Is either a PlannedFailoverModel type or a IO type. - Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PlannedFailoverModel or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PlannedFailoverModel] = 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._planned_failover_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PlannedFailoverModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_planned_failover.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_recovery_points_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_recovery_points_operations.py deleted file mode 100644 index e2fc1ca05662..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_recovery_points_operations.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._recovery_points_operations import build_get_request, build_list_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`recovery_points` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - recovery_point_name: str, - **kwargs: Any - ) -> _models.RecoveryPointModel: - """Gets the recovery point. - - Gets the details of the recovery point of a protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param recovery_point_name: The recovery point name. Required. - :type recovery_point_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryPointModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.RecoveryPointModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - recovery_point_name=recovery_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecoveryPointModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, protected_item_name: str, **kwargs: Any - ) -> AsyncIterable["_models.RecoveryPointModel"]: - """Lists the recovery points. - - Gets the list of recovery points of the given protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.RecoveryPointModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RecoveryPointModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_recovery_services_data_replication_mgmt_client_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_recovery_services_data_replication_mgmt_client_operations.py deleted file mode 100644 index ed6e8da6ad7a..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_recovery_services_data_replication_mgmt_client_operations.py +++ /dev/null @@ -1,321 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._recovery_services_data_replication_mgmt_client_operations import ( - build_check_name_availability_request, - build_deployment_preflight_request, -) -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RecoveryServicesDataReplicationMgmtClientOperationsMixin(RecoveryServicesDataReplicationMgmtClientMixinABC): - @overload - async def check_name_availability( - self, - location: str, - body: Optional[_models.CheckNameAvailabilityModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseModel: - """Performs the resource name availability check. - - Checks the resource name availability. - - :param location: The name of the Azure region. Required. - :type location: str - :param body: Resource details. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, location: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseModel: - """Performs the resource name availability check. - - Checks the resource name availability. - - :param location: The name of the Azure region. Required. - :type location: str - :param body: Resource details. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, location: str, body: Optional[Union[_models.CheckNameAvailabilityModel, IO]] = None, **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseModel: - """Performs the resource name availability check. - - Checks the resource name availability. - - :param location: The name of the Azure region. Required. - :type location: str - :param body: Resource details. Is either a CheckNameAvailabilityModel type or a IO type. - Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResponseModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "CheckNameAvailabilityModel") - else: - _json = None - - request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.check_name_availability.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResponseModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability" - } - - @overload - async def deployment_preflight( - self, - resource_group_name: str, - deployment_id: str, - body: Optional[_models.DeploymentPreflightModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DeploymentPreflightModel: - """Performs resource deployment validation. - - Performs resource deployment validation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_id: Deployment Id. Required. - :type deployment_id: str - :param body: Deployment preflight model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentPreflightModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def deployment_preflight( - self, - resource_group_name: str, - deployment_id: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DeploymentPreflightModel: - """Performs resource deployment validation. - - Performs resource deployment validation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_id: Deployment Id. Required. - :type deployment_id: str - :param body: Deployment preflight model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentPreflightModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def deployment_preflight( - self, - resource_group_name: str, - deployment_id: str, - body: Optional[Union[_models.DeploymentPreflightModel, IO]] = None, - **kwargs: Any - ) -> _models.DeploymentPreflightModel: - """Performs resource deployment validation. - - Performs resource deployment validation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_id: Deployment Id. Required. - :type deployment_id: str - :param body: Deployment preflight model. Is either a DeploymentPreflightModel type or a IO - type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentPreflightModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentPreflightModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "DeploymentPreflightModel") - else: - _json = None - - request = build_deployment_preflight_request( - resource_group_name=resource_group_name, - deployment_id=deployment_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.deployment_preflight.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeploymentPreflightModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - deployment_preflight.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_replication_extension_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_replication_extension_operation_status_operations.py deleted file mode 100644 index 016d75f382cd..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_replication_extension_operation_status_operations.py +++ /dev/null @@ -1,130 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._replication_extension_operation_status_operations import build_get_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationExtensionOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`replication_extension_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - operation_id: str, - **kwargs: Any - ) -> _models.OperationStatus: - """Gets the replication extension operation status. - - Tracks the results of an asynchronous operation on the replication extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_replication_extension_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_replication_extension_operations.py deleted file mode 100644 index 22740fb50191..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_replication_extension_operations.py +++ /dev/null @@ -1,610 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._replication_extension_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationExtensionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`replication_extension` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, replication_extension_name: str, **kwargs: Any - ) -> _models.ReplicationExtensionModel: - """Gets the replication extension. - - Gets the details of the replication extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationExtensionModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ReplicationExtensionModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ReplicationExtensionModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - async def _create_initial( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - body: Optional[Union[_models.ReplicationExtensionModel, IO]] = None, - **kwargs: Any - ) -> _models.ReplicationExtensionModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ReplicationExtensionModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ReplicationExtensionModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ReplicationExtensionModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ReplicationExtensionModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - body: Optional[_models.ReplicationExtensionModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationExtensionModel]: - """Puts the replication extension. - - Creates the replication extension in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :param body: Replication extension model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationExtensionModel or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationExtensionModel]: - """Puts the replication extension. - - Creates the replication extension in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :param body: Replication extension model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationExtensionModel or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - body: Optional[Union[_models.ReplicationExtensionModel, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationExtensionModel]: - """Puts the replication extension. - - Creates the replication extension in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :param body: Replication extension model. Is either a ReplicationExtensionModel type or a IO - type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationExtensionModel or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ReplicationExtensionModel] = 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, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ReplicationExtensionModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, replication_extension_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vault_name: str, replication_extension_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes the replication extension. - - Deletes the replication extension in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ReplicationExtensionModel"]: - """Lists the replication extensions. - - Gets the list of replication extensions in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationExtensionModel or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ReplicationExtensionModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ReplicationExtensionModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_vault_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_vault_operation_status_operations.py deleted file mode 100644 index 6a016515a96e..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_vault_operation_status_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._vault_operation_status_operations import build_get_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class VaultOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`vault_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the vault operation status. - - Tracks the results of an asynchronous operation on the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_vault_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_vault_operations.py deleted file mode 100644 index 213327ddc32f..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_vault_operations.py +++ /dev/null @@ -1,925 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._vault_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_subscription_request, - build_list_request, - build_update_request, -) -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class VaultOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`vault` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _models.VaultModel: - """Gets the vault. - - Gets the details of the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VaultModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - async def _create_initial( - self, - resource_group_name: str, - vault_name: str, - body: Optional[Union[_models.VaultModel, IO]] = None, - **kwargs: Any - ) -> _models.VaultModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VaultModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "VaultModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("VaultModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - body: Optional[_models.VaultModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VaultModel]: - """Puts the vault. - - Creates the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VaultModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VaultModel]: - """Puts the vault. - - Creates the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VaultModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - vault_name: str, - body: Optional[Union[_models.VaultModel, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VaultModel]: - """Puts the vault. - - Creates the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Is either a VaultModel type or a IO type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VaultModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VaultModel] = 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, - vault_name=vault_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VaultModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - async def _update_initial( - self, - resource_group_name: str, - vault_name: str, - body: Optional[Union[_models.VaultModelUpdate, IO]] = None, - **kwargs: Any - ) -> Optional[_models.VaultModel]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VaultModel]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "VaultModelUpdate") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("VaultModel", pipeline_response) - - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - vault_name: str, - body: Optional[_models.VaultModelUpdate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VaultModel]: - """Updates the vault. - - Performs update on the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VaultModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vault_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VaultModel]: - """Updates the vault. - - Performs update on the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VaultModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vault_name: str, - body: Optional[Union[_models.VaultModelUpdate, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VaultModel]: - """Updates the vault. - - Performs update on the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Is either a VaultModelUpdate type or a IO type. Default value is - None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VaultModel or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VaultModel] = 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, - vault_name=vault_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VaultModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes the vault. - - Removes the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - @distributed_trace - def list_by_subscription( - self, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultModel"]: - """Lists the vaults. - - Gets the list of vaults in the given subscription. - - :param continuation_token_parameter: Continuation token from the previous call. Default value - is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VaultModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VaultModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults" - } - - @distributed_trace - def list( - self, resource_group_name: str, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultModel"]: - """Lists the vaults. - - Gets the list of vaults in the given subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param continuation_token_parameter: Continuation token from the previous call. Default value - is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VaultModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VaultModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_workflow_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_workflow_operation_status_operations.py deleted file mode 100644 index 01b711e0f5c2..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_workflow_operation_status_operations.py +++ /dev/null @@ -1,125 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._workflow_operation_status_operations import build_get_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class WorkflowOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`workflow_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, job_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the job (workflow) operation status. - - Tracks the results of an asynchronous operation on the job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param job_name: The job (workflow) name. Required. - :type job_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - job_name=job_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_workflow_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_workflow_operations.py deleted file mode 100644 index eb027288f4e5..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/aio/operations/_workflow_operations.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._workflow_operations import build_get_request, build_list_request -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class WorkflowOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.aio.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`workflow` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, job_name: str, **kwargs: Any - ) -> _models.WorkflowModel: - """Gets the job (workflow). - - Gets the details of the job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param job_name: The job (workflow) name. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkflowModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkflowModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkflowModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}" - } - - @distributed_trace - def list( - self, - resource_group_name: str, - vault_name: str, - filter: Optional[str] = None, - continuation_token_parameter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.WorkflowModel"]: - """Lists the jobs (workflows). - - Gets the list of jobs in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param filter: Filter string. Default value is None. - :type filter: str - :param continuation_token_parameter: Continuation token. Default value is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkflowModel or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkflowModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - filter=filter, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkflowModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/__init__.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/__init__.py index 522d9fad6e96..43948d8591d7 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/__init__.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/__init__.py @@ -2,138 +2,152 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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 ._models_py3 import AzStackHCIClusterProperties -from ._models_py3 import AzStackHCIFabricModelCustomProperties -from ._models_py3 import CheckNameAvailabilityModel -from ._models_py3 import CheckNameAvailabilityResponseModel -from ._models_py3 import DeploymentPreflightModel -from ._models_py3 import DeploymentPreflightResource -from ._models_py3 import DraModel -from ._models_py3 import DraModelCollection -from ._models_py3 import DraModelCustomProperties -from ._models_py3 import DraModelProperties -from ._models_py3 import DraModelSystemData -from ._models_py3 import EmailConfigurationModel -from ._models_py3 import EmailConfigurationModelCollection -from ._models_py3 import EmailConfigurationModelProperties -from ._models_py3 import EmailConfigurationModelSystemData -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorModel -from ._models_py3 import ErrorResponse -from ._models_py3 import EventModel -from ._models_py3 import EventModelCollection -from ._models_py3 import EventModelCustomProperties -from ._models_py3 import EventModelProperties -from ._models_py3 import EventModelSystemData -from ._models_py3 import FabricModel -from ._models_py3 import FabricModelCollection -from ._models_py3 import FabricModelCustomProperties -from ._models_py3 import FabricModelProperties -from ._models_py3 import FabricModelSystemData -from ._models_py3 import FabricModelUpdate -from ._models_py3 import FabricModelUpdateSystemData -from ._models_py3 import FailoverProtectedItemProperties -from ._models_py3 import FailoverWorkflowModelCustomProperties -from ._models_py3 import HealthErrorModel -from ._models_py3 import HyperVMigrateFabricModelCustomProperties -from ._models_py3 import HyperVToAzStackHCIDiskInput -from ._models_py3 import HyperVToAzStackHCIEventModelCustomProperties -from ._models_py3 import HyperVToAzStackHCINicInput -from ._models_py3 import HyperVToAzStackHCIPlannedFailoverModelCustomProperties -from ._models_py3 import HyperVToAzStackHCIPolicyModelCustomProperties -from ._models_py3 import HyperVToAzStackHCIProtectedDiskProperties -from ._models_py3 import HyperVToAzStackHCIProtectedItemModelCustomProperties -from ._models_py3 import HyperVToAzStackHCIProtectedNicProperties -from ._models_py3 import HyperVToAzStackHCIRecoveryPointModelCustomProperties -from ._models_py3 import HyperVToAzStackHCIReplicationExtensionModelCustomProperties -from ._models_py3 import IdentityModel -from ._models_py3 import InnerHealthErrorModel -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import OperationModel -from ._models_py3 import OperationModelCollection -from ._models_py3 import OperationModelProperties -from ._models_py3 import OperationStatus -from ._models_py3 import PlannedFailoverModel -from ._models_py3 import PlannedFailoverModelCustomProperties -from ._models_py3 import PlannedFailoverModelProperties -from ._models_py3 import PolicyModel -from ._models_py3 import PolicyModelCollection -from ._models_py3 import PolicyModelCustomProperties -from ._models_py3 import PolicyModelProperties -from ._models_py3 import PolicyModelSystemData -from ._models_py3 import ProtectedItemDynamicMemoryConfig -from ._models_py3 import ProtectedItemJobProperties -from ._models_py3 import ProtectedItemModel -from ._models_py3 import ProtectedItemModelCollection -from ._models_py3 import ProtectedItemModelCustomProperties -from ._models_py3 import ProtectedItemModelProperties -from ._models_py3 import ProtectedItemModelPropertiesCurrentJob -from ._models_py3 import ProtectedItemModelPropertiesLastFailedEnableProtectionJob -from ._models_py3 import ProtectedItemModelPropertiesLastFailedPlannedFailoverJob -from ._models_py3 import ProtectedItemModelPropertiesLastTestFailoverJob -from ._models_py3 import ProtectedItemModelSystemData -from ._models_py3 import RecoveryPointModel -from ._models_py3 import RecoveryPointModelCollection -from ._models_py3 import RecoveryPointModelCustomProperties -from ._models_py3 import RecoveryPointModelProperties -from ._models_py3 import RecoveryPointModelSystemData -from ._models_py3 import ReplicationExtensionModel -from ._models_py3 import ReplicationExtensionModelCollection -from ._models_py3 import ReplicationExtensionModelCustomProperties -from ._models_py3 import ReplicationExtensionModelProperties -from ._models_py3 import ReplicationExtensionModelSystemData -from ._models_py3 import StorageContainerProperties -from ._models_py3 import SystemDataModel -from ._models_py3 import TaskModel -from ._models_py3 import TaskModelCustomProperties -from ._models_py3 import TestFailoverCleanupWorkflowModelCustomProperties -from ._models_py3 import TestFailoverWorkflowModelCustomProperties -from ._models_py3 import VMwareDraModelCustomProperties -from ._models_py3 import VMwareMigrateFabricModelCustomProperties -from ._models_py3 import VMwareToAzStackHCIDiskInput -from ._models_py3 import VMwareToAzStackHCINicInput -from ._models_py3 import VMwareToAzStackHCIPlannedFailoverModelCustomProperties -from ._models_py3 import VMwareToAzStackHCIPolicyModelCustomProperties -from ._models_py3 import VMwareToAzStackHCIProtectedDiskProperties -from ._models_py3 import VMwareToAzStackHCIProtectedItemModelCustomProperties -from ._models_py3 import VMwareToAzStackHCIProtectedNicProperties -from ._models_py3 import VMwareToAzStackHCIReplicationExtensionModelCustomProperties -from ._models_py3 import VaultModel -from ._models_py3 import VaultModelCollection -from ._models_py3 import VaultModelProperties -from ._models_py3 import VaultModelSystemData -from ._models_py3 import VaultModelUpdate -from ._models_py3 import VaultModelUpdateSystemData -from ._models_py3 import WorkflowModel -from ._models_py3 import WorkflowModelCollection -from ._models_py3 import WorkflowModelCustomProperties -from ._models_py3 import WorkflowModelProperties -from ._models_py3 import WorkflowModelSystemData +from typing import TYPE_CHECKING -from ._recovery_services_data_replication_mgmt_client_enums import ActionType -from ._recovery_services_data_replication_mgmt_client_enums import HealthStatus -from ._recovery_services_data_replication_mgmt_client_enums import Origin -from ._recovery_services_data_replication_mgmt_client_enums import ProtectedItemActiveLocation -from ._recovery_services_data_replication_mgmt_client_enums import ProtectionState -from ._recovery_services_data_replication_mgmt_client_enums import ProvisioningState -from ._recovery_services_data_replication_mgmt_client_enums import RecoveryPointType -from ._recovery_services_data_replication_mgmt_client_enums import ReplicationVaultType -from ._recovery_services_data_replication_mgmt_client_enums import ResynchronizationState -from ._recovery_services_data_replication_mgmt_client_enums import TaskState -from ._recovery_services_data_replication_mgmt_client_enums import TestFailoverState -from ._recovery_services_data_replication_mgmt_client_enums import VMNicSelection -from ._recovery_services_data_replication_mgmt_client_enums import VMwareToAzureMigrateResyncState -from ._recovery_services_data_replication_mgmt_client_enums import WorkflowObjectType -from ._recovery_services_data_replication_mgmt_client_enums import WorkflowState +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + AzStackHCIClusterProperties, + AzStackHCIFabricModelCustomProperties, + CheckNameAvailabilityModel, + CheckNameAvailabilityResponseModel, + ConnectionDetails, + DeploymentPreflightModel, + DeploymentPreflightResource, + DiskControllerInputs, + EmailConfigurationModel, + EmailConfigurationModelProperties, + ErrorAdditionalInfo, + ErrorDetail, + ErrorModel, + ErrorResponse, + EventModel, + EventModelCustomProperties, + EventModelProperties, + FabricAgentModel, + FabricAgentModelCustomProperties, + FabricAgentModelProperties, + FabricModel, + FabricModelCustomProperties, + FabricModelProperties, + FabricModelUpdate, + FailoverJobModelCustomProperties, + FailoverProtectedItemProperties, + GroupConnectivityInformation, + HealthErrorModel, + HyperVMigrateFabricModelCustomProperties, + HyperVToAzStackHCIDiskInput, + HyperVToAzStackHCIEventModelCustomProperties, + HyperVToAzStackHCINicInput, + HyperVToAzStackHCIPlannedFailoverModelCustomProperties, + HyperVToAzStackHCIPolicyModelCustomProperties, + HyperVToAzStackHCIProtectedDiskProperties, + HyperVToAzStackHCIProtectedItemModelCustomProperties, + HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate, + HyperVToAzStackHCIProtectedNicProperties, + HyperVToAzStackHCIRecoveryPointModelCustomProperties, + HyperVToAzStackHCIReplicationExtensionModelCustomProperties, + IdentityModel, + InnerHealthErrorModel, + JobModel, + JobModelCustomProperties, + JobModelCustomPropertiesAffectedObjectDetails, + JobModelProperties, + ManagedServiceIdentity, + Operation, + OperationDisplay, + OperationStatus, + PlannedFailoverModel, + PlannedFailoverModelCustomProperties, + PlannedFailoverModelProperties, + PolicyModel, + PolicyModelCustomProperties, + PolicyModelProperties, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionProxy, + PrivateEndpointConnectionProxyProperties, + PrivateEndpointConnectionResponseProperties, + PrivateLinkResource, + PrivateLinkResourceProperties, + PrivateLinkServiceConnection, + PrivateLinkServiceConnectionState, + PrivateLinkServiceProxy, + ProtectedItemDynamicMemoryConfig, + ProtectedItemJobProperties, + ProtectedItemModel, + ProtectedItemModelCustomProperties, + ProtectedItemModelCustomPropertiesUpdate, + ProtectedItemModelProperties, + ProtectedItemModelPropertiesUpdate, + ProtectedItemModelUpdate, + ProxyResource, + RecoveryPointModel, + RecoveryPointModelCustomProperties, + RecoveryPointModelProperties, + RemotePrivateEndpoint, + RemotePrivateEndpointConnection, + ReplicationExtensionModel, + ReplicationExtensionModelCustomProperties, + ReplicationExtensionModelProperties, + Resource, + StorageContainerProperties, + SystemData, + TaskModel, + TaskModelCustomProperties, + TestFailoverCleanupJobModelCustomProperties, + TestFailoverJobModelCustomProperties, + TrackedResource, + UserAssignedIdentity, + VMwareFabricAgentModelCustomProperties, + VMwareMigrateFabricModelCustomProperties, + VMwareToAzStackHCIDiskInput, + VMwareToAzStackHCIEventModelCustomProperties, + VMwareToAzStackHCINicInput, + VMwareToAzStackHCIPlannedFailoverModelCustomProperties, + VMwareToAzStackHCIPolicyModelCustomProperties, + VMwareToAzStackHCIProtectedDiskProperties, + VMwareToAzStackHCIProtectedItemModelCustomProperties, + VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate, + VMwareToAzStackHCIProtectedNicProperties, + VMwareToAzStackHCIRecoveryPointModelCustomProperties, + VMwareToAzStackHCIReplicationExtensionModelCustomProperties, + VaultIdentityModel, + VaultModel, + VaultModelProperties, + VaultModelUpdate, +) + +from ._enums import ( # type: ignore + ActionType, + CreatedByType, + HealthStatus, + JobObjectType, + JobState, + ManagedServiceIdentityType, + Origin, + PrivateEndpointConnectionStatus, + ProtectedItemActiveLocation, + ProtectionState, + ProvisioningState, + RecoveryPointType, + ReplicationVaultType, + ResynchronizationState, + TaskState, + TestFailoverState, + VMNicSelection, + VMwareToAzureMigrateResyncState, + VaultIdentityType, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -141,35 +155,29 @@ "AzStackHCIFabricModelCustomProperties", "CheckNameAvailabilityModel", "CheckNameAvailabilityResponseModel", + "ConnectionDetails", "DeploymentPreflightModel", "DeploymentPreflightResource", - "DraModel", - "DraModelCollection", - "DraModelCustomProperties", - "DraModelProperties", - "DraModelSystemData", + "DiskControllerInputs", "EmailConfigurationModel", - "EmailConfigurationModelCollection", "EmailConfigurationModelProperties", - "EmailConfigurationModelSystemData", "ErrorAdditionalInfo", "ErrorDetail", "ErrorModel", "ErrorResponse", "EventModel", - "EventModelCollection", "EventModelCustomProperties", "EventModelProperties", - "EventModelSystemData", + "FabricAgentModel", + "FabricAgentModelCustomProperties", + "FabricAgentModelProperties", "FabricModel", - "FabricModelCollection", "FabricModelCustomProperties", "FabricModelProperties", - "FabricModelSystemData", "FabricModelUpdate", - "FabricModelUpdateSystemData", + "FailoverJobModelCustomProperties", "FailoverProtectedItemProperties", - "FailoverWorkflowModelCustomProperties", + "GroupConnectivityInformation", "HealthErrorModel", "HyperVMigrateFabricModelCustomProperties", "HyperVToAzStackHCIDiskInput", @@ -179,77 +187,87 @@ "HyperVToAzStackHCIPolicyModelCustomProperties", "HyperVToAzStackHCIProtectedDiskProperties", "HyperVToAzStackHCIProtectedItemModelCustomProperties", + "HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate", "HyperVToAzStackHCIProtectedNicProperties", "HyperVToAzStackHCIRecoveryPointModelCustomProperties", "HyperVToAzStackHCIReplicationExtensionModelCustomProperties", "IdentityModel", "InnerHealthErrorModel", + "JobModel", + "JobModelCustomProperties", + "JobModelCustomPropertiesAffectedObjectDetails", + "JobModelProperties", + "ManagedServiceIdentity", "Operation", "OperationDisplay", - "OperationListResult", - "OperationModel", - "OperationModelCollection", - "OperationModelProperties", "OperationStatus", "PlannedFailoverModel", "PlannedFailoverModelCustomProperties", "PlannedFailoverModelProperties", "PolicyModel", - "PolicyModelCollection", "PolicyModelCustomProperties", "PolicyModelProperties", - "PolicyModelSystemData", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionProxy", + "PrivateEndpointConnectionProxyProperties", + "PrivateEndpointConnectionResponseProperties", + "PrivateLinkResource", + "PrivateLinkResourceProperties", + "PrivateLinkServiceConnection", + "PrivateLinkServiceConnectionState", + "PrivateLinkServiceProxy", "ProtectedItemDynamicMemoryConfig", "ProtectedItemJobProperties", "ProtectedItemModel", - "ProtectedItemModelCollection", "ProtectedItemModelCustomProperties", + "ProtectedItemModelCustomPropertiesUpdate", "ProtectedItemModelProperties", - "ProtectedItemModelPropertiesCurrentJob", - "ProtectedItemModelPropertiesLastFailedEnableProtectionJob", - "ProtectedItemModelPropertiesLastFailedPlannedFailoverJob", - "ProtectedItemModelPropertiesLastTestFailoverJob", - "ProtectedItemModelSystemData", + "ProtectedItemModelPropertiesUpdate", + "ProtectedItemModelUpdate", + "ProxyResource", "RecoveryPointModel", - "RecoveryPointModelCollection", "RecoveryPointModelCustomProperties", "RecoveryPointModelProperties", - "RecoveryPointModelSystemData", + "RemotePrivateEndpoint", + "RemotePrivateEndpointConnection", "ReplicationExtensionModel", - "ReplicationExtensionModelCollection", "ReplicationExtensionModelCustomProperties", "ReplicationExtensionModelProperties", - "ReplicationExtensionModelSystemData", + "Resource", "StorageContainerProperties", - "SystemDataModel", + "SystemData", "TaskModel", "TaskModelCustomProperties", - "TestFailoverCleanupWorkflowModelCustomProperties", - "TestFailoverWorkflowModelCustomProperties", - "VMwareDraModelCustomProperties", + "TestFailoverCleanupJobModelCustomProperties", + "TestFailoverJobModelCustomProperties", + "TrackedResource", + "UserAssignedIdentity", + "VMwareFabricAgentModelCustomProperties", "VMwareMigrateFabricModelCustomProperties", "VMwareToAzStackHCIDiskInput", + "VMwareToAzStackHCIEventModelCustomProperties", "VMwareToAzStackHCINicInput", "VMwareToAzStackHCIPlannedFailoverModelCustomProperties", "VMwareToAzStackHCIPolicyModelCustomProperties", "VMwareToAzStackHCIProtectedDiskProperties", "VMwareToAzStackHCIProtectedItemModelCustomProperties", + "VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate", "VMwareToAzStackHCIProtectedNicProperties", + "VMwareToAzStackHCIRecoveryPointModelCustomProperties", "VMwareToAzStackHCIReplicationExtensionModelCustomProperties", + "VaultIdentityModel", "VaultModel", - "VaultModelCollection", "VaultModelProperties", - "VaultModelSystemData", "VaultModelUpdate", - "VaultModelUpdateSystemData", - "WorkflowModel", - "WorkflowModelCollection", - "WorkflowModelCustomProperties", - "WorkflowModelProperties", - "WorkflowModelSystemData", "ActionType", + "CreatedByType", "HealthStatus", + "JobObjectType", + "JobState", + "ManagedServiceIdentityType", "Origin", + "PrivateEndpointConnectionStatus", "ProtectedItemActiveLocation", "ProtectionState", "ProvisioningState", @@ -260,8 +278,7 @@ "TestFailoverState", "VMNicSelection", "VMwareToAzureMigrateResyncState", - "WorkflowObjectType", - "WorkflowState", + "VaultIdentityType", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_enums.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_enums.py new file mode 100644 index 000000000000..9052d63a1a61 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_enums.py @@ -0,0 +1,376 @@ +# 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 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 HealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the fabric health.""" + + NORMAL = "Normal" + """Healthy Status.""" + WARNING = "Warning" + """Warning Status.""" + CRITICAL = "Critical" + """Critical Status.""" + + +class JobObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the object type.""" + + AVS_DISK_POOL = "AvsDiskPool" + """AVS disk pool.""" + FABRIC_AGENT = "FabricAgent" + """Fabric agent level workflow.""" + FABRIC = "Fabric" + """Fabric level job.""" + POLICY = "Policy" + """Policy level job.""" + PROTECTED_ITEM = "ProtectedItem" + """Protected item level job.""" + RECOVERY_PLAN = "RecoveryPlan" + """Recovery plan level job.""" + REPLICATION_EXTENSION = "ReplicationExtension" + """Replication extension level job.""" + VAULT = "Vault" + """Vault level job.""" + + +class JobState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the job state.""" + + PENDING = "Pending" + """Job has not been started.""" + STARTED = "Started" + """Job is in progress.""" + CANCELLING = "Cancelling" + """Job cancellation is in progress.""" + SUCCEEDED = "Succeeded" + """Job has completed successfully.""" + FAILED = "Failed" + """Job failed.""" + CANCELLED = "Cancelled" + """Job has been cancelled.""" + COMPLETED_WITH_INFORMATION = "CompletedWithInformation" + """Job has completed with information.""" + COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + """Job has completed with warnings.""" + COMPLETED_WITH_ERRORS = "CompletedWithErrors" + """Job has completed with errors.""" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + """No managed identity.""" + SYSTEM_ASSIGNED = "SystemAssigned" + """System assigned managed identity.""" + USER_ASSIGNED = "UserAssigned" + """User assigned managed identity.""" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + """System and user assigned managed identity.""" + + +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 PrivateEndpointConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the status.""" + + APPROVED = "Approved" + """Approved Status.""" + DISCONNECTED = "Disconnected" + """Disconnected Status.""" + PENDING = "Pending" + """Pending Status.""" + REJECTED = "Rejected" + """Rejected Status.""" + + +class ProtectedItemActiveLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the location of the protected item.""" + + PRIMARY = "Primary" + """Protected item is active on Primary.""" + RECOVERY = "Recovery" + """Protected item is active on Recovery.""" + + +class ProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the protection state.""" + + UNPROTECTED_STATES_BEGIN = "UnprotectedStatesBegin" + """Begin marker for unprotected states.""" + ENABLING_PROTECTION = "EnablingProtection" + """Enable protection is in progress.""" + ENABLING_FAILED = "EnablingFailed" + """Enable protection failed.""" + DISABLING_PROTECTION = "DisablingProtection" + """Disabling protection is in progress.""" + MARKED_FOR_DELETION = "MarkedForDeletion" + """Disabling protection succeeded. This is a transient state before the protected item is deleted.""" + DISABLING_FAILED = "DisablingFailed" + """Disable protection failed.""" + UNPROTECTED_STATES_END = "UnprotectedStatesEnd" + """End marker for unprotected states.""" + INITIAL_REPLICATION_STATES_BEGIN = "InitialReplicationStatesBegin" + """Begin marker for initial replication states.""" + INITIAL_REPLICATION_IN_PROGRESS = "InitialReplicationInProgress" + """Initial replication is in progress.""" + INITIAL_REPLICATION_COMPLETED_ON_PRIMARY = "InitialReplicationCompletedOnPrimary" + """Initial replication has completed on the primary side.""" + INITIAL_REPLICATION_COMPLETED_ON_RECOVERY = "InitialReplicationCompletedOnRecovery" + """Initial replication has completed on the recovery side.""" + INITIAL_REPLICATION_FAILED = "InitialReplicationFailed" + """Initial replication failed and would need to be started again.""" + INITIAL_REPLICATION_STATES_END = "InitialReplicationStatesEnd" + """End marker for initial replication states.""" + PROTECTED_STATES_BEGIN = "ProtectedStatesBegin" + """Begin marker for protected steady-state states.""" + PROTECTED = "Protected" + """Protected item is protected and replication is on-going. Any issues with replication will be + surfaced separately via the health property and will not affect the state.""" + PROTECTED_STATES_END = "ProtectedStatesEnd" + """End marker for protected steady-state states.""" + PLANNED_FAILOVER_TRANSITION_STATES_BEGIN = "PlannedFailoverTransitionStatesBegin" + """Begin marker for planned failover transition states.""" + PLANNED_FAILOVER_INITIATED = "PlannedFailoverInitiated" + """Planned failover has been initiated.""" + PLANNED_FAILOVER_COMPLETING = "PlannedFailoverCompleting" + """Planned failover preparing protected entities is in progress.""" + PLANNED_FAILOVER_COMPLETED = "PlannedFailoverCompleted" + """Planned failover has been completed successfully.""" + PLANNED_FAILOVER_FAILED = "PlannedFailoverFailed" + """Planned failover initiation failed.""" + PLANNED_FAILOVER_COMPLETION_FAILED = "PlannedFailoverCompletionFailed" + """Planned failover preparing protected entities failed.""" + PLANNED_FAILOVER_TRANSITION_STATES_END = "PlannedFailoverTransitionStatesEnd" + """End marker for planned failover transition states.""" + UNPLANNED_FAILOVER_TRANSITION_STATES_BEGIN = "UnplannedFailoverTransitionStatesBegin" + """Begin marker for unplanned failover transition states.""" + UNPLANNED_FAILOVER_INITIATED = "UnplannedFailoverInitiated" + """Unplanned failover has been initiated.""" + UNPLANNED_FAILOVER_COMPLETING = "UnplannedFailoverCompleting" + """Unplanned failover preparing protected entities is in progress.""" + UNPLANNED_FAILOVER_COMPLETED = "UnplannedFailoverCompleted" + """Unplanned failover preparing protected entities is in progress.""" + UNPLANNED_FAILOVER_FAILED = "UnplannedFailoverFailed" + """Unplanned failover initiation failed.""" + UNPLANNED_FAILOVER_COMPLETION_FAILED = "UnplannedFailoverCompletionFailed" + """Unplanned failover preparing protected entities failed.""" + UNPLANNED_FAILOVER_TRANSITION_STATES_END = "UnplannedFailoverTransitionStatesEnd" + """End marker for unplanned failover transition states.""" + COMMIT_FAILOVER_STATES_BEGIN = "CommitFailoverStatesBegin" + """Begin marker for commit failover states.""" + COMMIT_FAILOVER_IN_PROGRESS_ON_PRIMARY = "CommitFailoverInProgressOnPrimary" + """Commit failover is in progress on the primary side.""" + COMMIT_FAILOVER_IN_PROGRESS_ON_RECOVERY = "CommitFailoverInProgressOnRecovery" + """Commit failover is in progress on the recovery side.""" + COMMIT_FAILOVER_COMPLETED = "CommitFailoverCompleted" + """Commit failover has been completed successfully.""" + COMMIT_FAILOVER_FAILED_ON_PRIMARY = "CommitFailoverFailedOnPrimary" + """Commit failover failed on the primary side.""" + COMMIT_FAILOVER_FAILED_ON_RECOVERY = "CommitFailoverFailedOnRecovery" + """Commit failover failed on the recovery side.""" + COMMIT_FAILOVER_STATES_END = "CommitFailoverStatesEnd" + """End marker for commit failover states.""" + CANCEL_FAILOVER_STATES_BEGIN = "CancelFailoverStatesBegin" + """Begin marker for cancel failover states.""" + CANCEL_FAILOVER_IN_PROGRESS_ON_PRIMARY = "CancelFailoverInProgressOnPrimary" + """Cancel failover is in progress on the primary side.""" + CANCEL_FAILOVER_IN_PROGRESS_ON_RECOVERY = "CancelFailoverInProgressOnRecovery" + """Cancel failover is in progress on the recovery side.""" + CANCEL_FAILOVER_FAILED_ON_PRIMARY = "CancelFailoverFailedOnPrimary" + """Cancel failover failed on the primary side.""" + CANCEL_FAILOVER_FAILED_ON_RECOVERY = "CancelFailoverFailedOnRecovery" + """Cancel failover failed on the recovery side.""" + CANCEL_FAILOVER_STATES_END = "CancelFailoverStatesEnd" + """End marker for cancel failover states.""" + CHANGE_RECOVERY_POINT_STATES_BEGIN = "ChangeRecoveryPointStatesBegin" + """Begin marker for change recovery point states.""" + CHANGE_RECOVERY_POINT_INITIATED = "ChangeRecoveryPointInitiated" + """Change recovery point has been initiated..""" + CHANGE_RECOVERY_POINT_COMPLETED = "ChangeRecoveryPointCompleted" + """Change recovery point has been completed successfully.""" + CHANGE_RECOVERY_POINT_FAILED = "ChangeRecoveryPointFailed" + """Change recovery point has failed.""" + CHANGE_RECOVERY_POINT_STATES_END = "ChangeRecoveryPointStatesEnd" + """End marker for change recovery point states.""" + REPROTECT_STATES_BEGIN = "ReprotectStatesBegin" + """Begin marker for reprotect states.""" + REPROTECT_INITIATED = "ReprotectInitiated" + """Reprotect has been initiated.""" + REPROTECT_FAILED = "ReprotectFailed" + """Reprotect has failed.""" + REPROTECT_STATES_END = "ReprotectStatesEnd" + """End marker for reprotect states.""" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the provisioning state of the email configuration.""" + + CANCELED = "Canceled" + """Resource creation has been canceled""" + CREATING = "Creating" + """Resource is being created.""" + DELETING = "Deleting" + """Resource is being deleted.""" + DELETED = "Deleted" + """Resource has been deleted.""" + FAILED = "Failed" + """Resource creation failed.""" + SUCCEEDED = "Succeeded" + """Resource creation/update succeeded.""" + UPDATING = "Updating" + """Resource is being updated.""" + + +class RecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the recovery point type.""" + + APPLICATION_CONSISTENT = "ApplicationConsistent" + """Application consistent recovery point.""" + CRASH_CONSISTENT = "CrashConsistent" + """Crash consistent recovery point.""" + + +class ReplicationVaultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the type of vault.""" + + DISASTER_RECOVERY = "DisasterRecovery" + """Disaster recovery vault.""" + MIGRATE = "Migrate" + """Migrate vault.""" + + +class ResynchronizationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the resynchronization state.""" + + NONE = "None" + """Resynchronization is not active.""" + RESYNCHRONIZATION_INITIATED = "ResynchronizationInitiated" + """Resynchronization has been initiated.""" + RESYNCHRONIZATION_COMPLETED = "ResynchronizationCompleted" + """Resynchronization has been completed successfully.""" + RESYNCHRONIZATION_FAILED = "ResynchronizationFailed" + """Resynchronization has failed and would need to be started again.""" + + +class TaskState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the task state.""" + + PENDING = "Pending" + """Task has not been started.""" + STARTED = "Started" + """Task is in progress.""" + SUCCEEDED = "Succeeded" + """Task has completed successfully.""" + FAILED = "Failed" + """Task failed.""" + CANCELLED = "Cancelled" + """Task has been cancelled.""" + SKIPPED = "Skipped" + """Task has been skipped.""" + + +class TestFailoverState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the test failover state.""" + + NONE = "None" + """Test failover is not active.""" + TEST_FAILOVER_INITIATED = "TestFailoverInitiated" + """Test failover has been initiated.""" + TEST_FAILOVER_COMPLETING = "TestFailoverCompleting" + """Preparing test protected entities is in progress.""" + TEST_FAILOVER_COMPLETED = "TestFailoverCompleted" + """Test failover has been completed successfully.""" + TEST_FAILOVER_FAILED = "TestFailoverFailed" + """Test failover initiation failed..""" + TEST_FAILOVER_COMPLETION_FAILED = "TestFailoverCompletionFailed" + """Preparing test protected entities failed.""" + TEST_FAILOVER_CLEANUP_INITIATED = "TestFailoverCleanupInitiated" + """Test failover cleanup has been initiated.""" + TEST_FAILOVER_CLEANUP_COMPLETING = "TestFailoverCleanupCompleting" + """Cleaning up test protected entities is in progress.""" + MARKED_FOR_DELETION = "MarkedForDeletion" + """Test failover cleanup has completed/failed. This is a transient state before the state is moved + back to None.""" + + +class VaultIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the identityType which can be either SystemAssigned or None.""" + + NONE = "None" + """No identity.""" + SYSTEM_ASSIGNED = "SystemAssigned" + """System assigned identity.""" + USER_ASSIGNED = "UserAssigned" + """User assigned identity.""" + + +class VMNicSelection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the selection type of the NIC.""" + + NOT_SELECTED = "NotSelected" + """Not Selected.""" + SELECTED_BY_USER = "SelectedByUser" + """Selected by user.""" + SELECTED_BY_DEFAULT = "SelectedByDefault" + """Default selection by ASR.""" + SELECTED_BY_USER_OVERRIDE = "SelectedByUserOverride" + """NIC configuration overridden by user. Differs from SelectedByUser in the sense that the legacy + SelectedByUser is used both for explicit modification by user and implicit approval of user if + the settings are used for TFO/FO. SelectedByUserOverride implies user overriding at least one + of the configurations.""" + + +class VMwareToAzureMigrateResyncState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the resync state.""" + + NONE = "None" + """None state.""" + PREPARED_FOR_RESYNCHRONIZATION = "PreparedForResynchronization" + """Prepared for resynchronization state.""" + STARTED_RESYNCHRONIZATION = "StartedResynchronization" + """Started resynchronization state.""" diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_models.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_models.py new file mode 100644 index 000000000000..4dbf1687b2b4 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_models.py @@ -0,0 +1,5926 @@ +# 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 .._utils.model_base import Model as _Model, rest_discriminator, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class AzStackHCIClusterProperties(_Model): + """AzStackHCI cluster properties. + + :ivar cluster_name: Gets or sets the AzStackHCICluster FQDN name. Required. + :vartype cluster_name: str + :ivar resource_name: Gets or sets the AzStackHCICluster resource name. Required. + :vartype resource_name: str + :ivar storage_account_name: Gets or sets the Storage account name. Required. + :vartype storage_account_name: str + :ivar storage_containers: Gets or sets the list of AzStackHCICluster Storage Container. + Required. + :vartype storage_containers: + list[~azure.mgmt.recoveryservicesdatareplication.models.StorageContainerProperties] + """ + + cluster_name: str = rest_field(name="clusterName", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the AzStackHCICluster FQDN name. Required.""" + resource_name: str = rest_field(name="resourceName", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the AzStackHCICluster resource name. Required.""" + storage_account_name: str = rest_field( + name="storageAccountName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Storage account name. Required.""" + storage_containers: List["_models.StorageContainerProperties"] = rest_field( + name="storageContainers", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of AzStackHCICluster Storage Container. Required.""" + + @overload + def __init__( + self, + *, + cluster_name: str, + resource_name: str, + storage_account_name: str, + storage_containers: List["_models.StorageContainerProperties"], + ) -> 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 FabricModelCustomProperties(_Model): + """Fabric model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzStackHCIFabricModelCustomProperties, HyperVMigrateFabricModelCustomProperties, + VMwareMigrateFabricModelCustomProperties + + :ivar instance_type: Discriminator property for FabricModelCustomProperties. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for FabricModelCustomProperties. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: 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 AzStackHCIFabricModelCustomProperties(FabricModelCustomProperties, discriminator="AzStackHCI"): + """AzStackHCI fabric model custom properties. + + :ivar az_stack_hci_site_id: Gets or sets the ARM Id of the AzStackHCI site. Required. + :vartype az_stack_hci_site_id: str + :ivar appliance_name: Gets or sets the Appliance name. + :vartype appliance_name: list[str] + :ivar cluster: AzStackHCI cluster properties. Required. + :vartype cluster: + ~azure.mgmt.recoveryservicesdatareplication.models.AzStackHCIClusterProperties + :ivar fabric_resource_id: Gets or sets the fabric resource Id. + :vartype fabric_resource_id: str + :ivar fabric_container_id: Gets or sets the fabric container Id. + :vartype fabric_container_id: str + :ivar migration_solution_id: Gets or sets the Migration solution ARM Id. Required. + :vartype migration_solution_id: str + :ivar migration_hub_uri: Gets or sets the migration hub Uri. + :vartype migration_hub_uri: str + :ivar instance_type: Gets or sets the instance type. Required. Default value is "AzStackHCI". + :vartype instance_type: str + """ + + az_stack_hci_site_id: str = rest_field( + name="azStackHciSiteId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ARM Id of the AzStackHCI site. Required.""" + appliance_name: Optional[List[str]] = rest_field(name="applianceName", visibility=["read"]) + """Gets or sets the Appliance name.""" + cluster: "_models.AzStackHCIClusterProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """AzStackHCI cluster properties. Required.""" + fabric_resource_id: Optional[str] = rest_field(name="fabricResourceId", visibility=["read"]) + """Gets or sets the fabric resource Id.""" + fabric_container_id: Optional[str] = rest_field(name="fabricContainerId", visibility=["read"]) + """Gets or sets the fabric container Id.""" + migration_solution_id: str = rest_field( + name="migrationSolutionId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Migration solution ARM Id. Required.""" + migration_hub_uri: Optional[str] = rest_field(name="migrationHubUri", visibility=["read"]) + """Gets or sets the migration hub Uri.""" + instance_type: Literal["AzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"AzStackHCI\".""" + + @overload + def __init__( + self, + *, + az_stack_hci_site_id: str, + cluster: "_models.AzStackHCIClusterProperties", + migration_solution_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, instance_type="AzStackHCI", **kwargs) + + +class CheckNameAvailabilityModel(_Model): + """Check name availability model. + + :ivar name: Gets or sets the resource name. + :vartype name: str + :ivar type: Gets or sets the resource type. + :vartype type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the resource name.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the resource type.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + 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 CheckNameAvailabilityResponseModel(_Model): + """Check name availability response model. + + :ivar name_available: Gets or sets a value indicating whether resource name is available or + not. + :vartype name_available: bool + :ivar reason: Gets or sets the reason for resource name unavailability. + :vartype reason: str + :ivar message: Gets or sets the message for resource name unavailability. + :vartype message: str + """ + + name_available: Optional[bool] = rest_field( + name="nameAvailable", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether resource name is available or not.""" + reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the reason for resource name unavailability.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the message for resource name unavailability.""" + + @overload + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: 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 ConnectionDetails(_Model): + """Private endpoint connection details at member level. + + :ivar id: Gets or sets id. + :vartype id: str + :ivar private_ip_address: Gets or sets private IP address. + :vartype private_ip_address: str + :ivar link_identifier: Gets or sets link identifier. + :vartype link_identifier: str + :ivar group_id: Gets or sets group id. + :vartype group_id: str + :ivar member_name: Gets or sets member name. + :vartype member_name: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets id.""" + private_ip_address: Optional[str] = rest_field( + name="privateIpAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets private IP address.""" + link_identifier: Optional[str] = rest_field( + name="linkIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets link identifier.""" + group_id: Optional[str] = rest_field(name="groupId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets group id.""" + member_name: Optional[str] = rest_field( + name="memberName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets member name.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + private_ip_address: Optional[str] = None, + link_identifier: Optional[str] = None, + group_id: Optional[str] = None, + member_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 DeploymentPreflightModel(_Model): + """Deployment preflight model. + + :ivar resources: Gets or sets the list of resources. + :vartype resources: + list[~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightResource] + """ + + resources: Optional[List["_models.DeploymentPreflightResource"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of resources.""" + + @overload + def __init__( + self, + *, + resources: Optional[List["_models.DeploymentPreflightResource"]] = 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 DeploymentPreflightResource(_Model): + """Deployment preflight resource. + + :ivar name: Gets or sets the resource name. + :vartype name: str + :ivar type: Gets or sets the resource type. + :vartype type: str + :ivar location: Gets or sets the location of the resource. + :vartype location: str + :ivar api_version: Gets or sets the Api version. + :vartype api_version: str + :ivar properties: Gets or sets the properties of the resource. + :vartype properties: any + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the resource name.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the resource type.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """Gets or sets the location of the resource.""" + api_version: Optional[str] = rest_field( + name="apiVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Api version.""" + properties: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the properties of the resource.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + location: Optional[str] = None, + api_version: Optional[str] = None, + properties: Optional[Any] = 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 DiskControllerInputs(_Model): + """Disk controller. + + :ivar controller_name: Gets or sets the controller name (IDE,SCSI). Required. + :vartype controller_name: str + :ivar controller_id: Gets or sets the controller ID. Required. + :vartype controller_id: int + :ivar controller_location: Gets or sets the controller Location. Required. + :vartype controller_location: int + """ + + controller_name: str = rest_field(name="controllerName", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the controller name (IDE,SCSI). Required.""" + controller_id: int = rest_field(name="controllerId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the controller ID. Required.""" + controller_location: int = rest_field( + name="controllerLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the controller Location. Required.""" + + @overload + def __init__( + self, + *, + controller_name: str, + controller_id: int, + controller_location: 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 Resource(_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.recoveryservicesdatareplication.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 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.recoveryservicesdatareplication.models.SystemData + """ + + +class EmailConfigurationModel(ProxyResource): + """Email configuration 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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModelProperties + """ + + properties: Optional["_models.EmailConfigurationModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.EmailConfigurationModelProperties"] = 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 EmailConfigurationModelProperties(_Model): + """Email configuration model properties. + + :ivar send_to_owners: Gets or sets a value indicating whether to send email to subscription + administrator. Required. + :vartype send_to_owners: bool + :ivar custom_email_addresses: Gets or sets the custom email address for sending emails. + :vartype custom_email_addresses: list[str] + :ivar locale: Gets or sets the locale for the email notification. + :vartype locale: str + :ivar provisioning_state: Gets or sets the provisioning state of the email configuration. Known + values are: "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and + "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + """ + + send_to_owners: bool = rest_field(name="sendToOwners", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets a value indicating whether to send email to subscription administrator. Required.""" + custom_email_addresses: Optional[List[str]] = rest_field( + name="customEmailAddresses", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the custom email address for sending emails.""" + locale: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the locale for the email notification.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the email configuration. Known values are: \"Canceled\", + \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and \"Updating\".""" + + @overload + def __init__( + self, + *, + send_to_owners: bool, + custom_email_addresses: Optional[List[str]] = None, + locale: 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): + """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): + """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.recoveryservicesdatareplication.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.recoveryservicesdatareplication.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 ErrorModel(_Model): + """Error model. + + :ivar code: Gets or sets the error code. + :vartype code: str + :ivar type: Gets or sets the error type. + :vartype type: str + :ivar severity: Gets or sets the error severity. + :vartype severity: str + :ivar creation_time: Gets or sets the creation time of error. + :vartype creation_time: ~datetime.datetime + :ivar message: Gets or sets the error message. + :vartype message: str + :ivar causes: Gets or sets the possible causes of error. + :vartype causes: str + :ivar recommendation: Gets or sets the recommended action to resolve error. + :vartype recommendation: str + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error code.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error type.""" + severity: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error severity.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Gets or sets the creation time of error.""" + message: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error message.""" + causes: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the possible causes of error.""" + recommendation: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the recommended action to resolve error.""" + + +class ErrorResponse(_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.recoveryservicesdatareplication.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 EventModel(ProxyResource): + """Event 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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.EventModelProperties + """ + + properties: Optional["_models.EventModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.EventModelProperties"] = 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 EventModelCustomProperties(_Model): + """Event model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVToAzStackHCIEventModelCustomProperties, VMwareToAzStackHCIEventModelCustomProperties + + :ivar instance_type: Discriminator property for EventModelCustomProperties. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for EventModelCustomProperties. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: 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 EventModelProperties(_Model): + """Event model properties. + + :ivar resource_type: Gets or sets the resource type. + :vartype resource_type: str + :ivar resource_name: Gets or sets the resource name. + :vartype resource_name: str + :ivar event_type: Gets or sets the event type. + :vartype event_type: str + :ivar event_name: Gets or sets the event name. + :vartype event_name: str + :ivar time_of_occurrence: Gets or sets the time at which the event occurred at source. + :vartype time_of_occurrence: ~datetime.datetime + :ivar severity: Gets or sets the event severity. + :vartype severity: str + :ivar description: Gets or sets the event description. + :vartype description: str + :ivar correlation_id: Gets or sets the event correlation Id. + :vartype correlation_id: str + :ivar health_errors: Gets or sets the errors associated with this event. + :vartype health_errors: + list[~azure.mgmt.recoveryservicesdatareplication.models.HealthErrorModel] + :ivar custom_properties: Event model custom properties. Required. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.EventModelCustomProperties + :ivar provisioning_state: Gets or sets the provisioning state of the event. Known values are: + "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + """ + + resource_type: Optional[str] = rest_field(name="resourceType", visibility=["read"]) + """Gets or sets the resource type.""" + resource_name: Optional[str] = rest_field(name="resourceName", visibility=["read"]) + """Gets or sets the resource name.""" + event_type: Optional[str] = rest_field(name="eventType", visibility=["read"]) + """Gets or sets the event type.""" + event_name: Optional[str] = rest_field(name="eventName", visibility=["read"]) + """Gets or sets the event name.""" + time_of_occurrence: Optional[datetime.datetime] = rest_field( + name="timeOfOccurrence", visibility=["read"], format="rfc3339" + ) + """Gets or sets the time at which the event occurred at source.""" + severity: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the event severity.""" + description: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the event description.""" + correlation_id: Optional[str] = rest_field(name="correlationId", visibility=["read"]) + """Gets or sets the event correlation Id.""" + health_errors: Optional[List["_models.HealthErrorModel"]] = rest_field(name="healthErrors", visibility=["read"]) + """Gets or sets the errors associated with this event.""" + custom_properties: "_models.EventModelCustomProperties" = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Event model custom properties. Required.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the event. Known values are: \"Canceled\", \"Creating\", + \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and \"Updating\".""" + + @overload + def __init__( + self, + *, + custom_properties: "_models.EventModelCustomProperties", + ) -> 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 FabricAgentModel(ProxyResource): + """Fabric agent 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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModelProperties + """ + + properties: Optional["_models.FabricAgentModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.FabricAgentModelProperties"] = 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 FabricAgentModelCustomProperties(_Model): + """Fabric agent model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareFabricAgentModelCustomProperties + + :ivar instance_type: Discriminator property for FabricAgentModelCustomProperties. Required. + Default value is None. + :vartype instance_type: str + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for FabricAgentModelCustomProperties. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: 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 FabricAgentModelProperties(_Model): + """Fabric agent model properties. + + :ivar correlation_id: Gets or sets the fabric agent correlation Id. + :vartype correlation_id: str + :ivar machine_id: Gets or sets the machine Id where fabric agent is running. Required. + :vartype machine_id: str + :ivar machine_name: Gets or sets the machine name where fabric agent is running. Required. + :vartype machine_name: str + :ivar authentication_identity: Identity model. Required. + :vartype authentication_identity: + ~azure.mgmt.recoveryservicesdatareplication.models.IdentityModel + :ivar resource_access_identity: Identity model. Required. + :vartype resource_access_identity: + ~azure.mgmt.recoveryservicesdatareplication.models.IdentityModel + :ivar is_responsive: Gets or sets a value indicating whether the fabric agent is responsive. + :vartype is_responsive: bool + :ivar last_heartbeat: Gets or sets the time when last heartbeat was sent by the fabric agent. + :vartype last_heartbeat: ~datetime.datetime + :ivar version_number: Gets or sets the fabric agent version. + :vartype version_number: str + :ivar provisioning_state: Gets or sets the provisioning state of the fabric agent. Known values + are: "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + :ivar health_errors: Gets or sets the list of health errors. + :vartype health_errors: + list[~azure.mgmt.recoveryservicesdatareplication.models.HealthErrorModel] + :ivar custom_properties: Fabric agent model custom properties. Required. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModelCustomProperties + """ + + correlation_id: Optional[str] = rest_field(name="correlationId", visibility=["read"]) + """Gets or sets the fabric agent correlation Id.""" + machine_id: str = rest_field(name="machineId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the machine Id where fabric agent is running. Required.""" + machine_name: str = rest_field(name="machineName", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the machine name where fabric agent is running. Required.""" + authentication_identity: "_models.IdentityModel" = rest_field( + name="authenticationIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """Identity model. Required.""" + resource_access_identity: "_models.IdentityModel" = rest_field( + name="resourceAccessIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """Identity model. Required.""" + is_responsive: Optional[bool] = rest_field(name="isResponsive", visibility=["read"]) + """Gets or sets a value indicating whether the fabric agent is responsive.""" + last_heartbeat: Optional[datetime.datetime] = rest_field( + name="lastHeartbeat", visibility=["read"], format="rfc3339" + ) + """Gets or sets the time when last heartbeat was sent by the fabric agent.""" + version_number: Optional[str] = rest_field(name="versionNumber", visibility=["read"]) + """Gets or sets the fabric agent version.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the fabric agent. Known values are: \"Canceled\", + \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and \"Updating\".""" + health_errors: Optional[List["_models.HealthErrorModel"]] = rest_field(name="healthErrors", visibility=["read"]) + """Gets or sets the list of health errors.""" + custom_properties: "_models.FabricAgentModelCustomProperties" = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric agent model custom properties. Required.""" + + @overload + def __init__( + self, + *, + machine_id: str, + machine_name: str, + authentication_identity: "_models.IdentityModel", + resource_access_identity: "_models.IdentityModel", + custom_properties: "_models.FabricAgentModelCustomProperties", + ) -> 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 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.recoveryservicesdatareplication.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 FabricModel(TrackedResource): + """Fabric 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.recoveryservicesdatareplication.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.recoveryservicesdatareplication.models.FabricModelProperties + """ + + properties: Optional["_models.FabricModelProperties"] = 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.FabricModelProperties"] = 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 FabricModelProperties(_Model): + """Fabric model properties. + + :ivar provisioning_state: Gets or sets the provisioning state of the fabric. Known values are: + "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + :ivar service_endpoint: Gets or sets the service endpoint. + :vartype service_endpoint: str + :ivar service_resource_id: Gets or sets the service resource Id. + :vartype service_resource_id: str + :ivar health: Gets or sets the fabric health. Known values are: "Normal", "Warning", and + "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicesdatareplication.models.HealthStatus + :ivar health_errors: Gets or sets the list of health errors. + :vartype health_errors: + list[~azure.mgmt.recoveryservicesdatareplication.models.HealthErrorModel] + :ivar custom_properties: Fabric model custom properties. Required. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelCustomProperties + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the fabric. Known values are: \"Canceled\", + \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and \"Updating\".""" + service_endpoint: Optional[str] = rest_field(name="serviceEndpoint", visibility=["read"]) + """Gets or sets the service endpoint.""" + service_resource_id: Optional[str] = rest_field(name="serviceResourceId", visibility=["read"]) + """Gets or sets the service resource Id.""" + health: Optional[Union[str, "_models.HealthStatus"]] = rest_field(visibility=["read"]) + """Gets or sets the fabric health. Known values are: \"Normal\", \"Warning\", and \"Critical\".""" + health_errors: Optional[List["_models.HealthErrorModel"]] = rest_field(name="healthErrors", visibility=["read"]) + """Gets or sets the list of health errors.""" + custom_properties: "_models.FabricModelCustomProperties" = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric model custom properties. Required.""" + + @overload + def __init__( + self, + *, + custom_properties: "_models.FabricModelCustomProperties", + ) -> 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 FabricModelUpdate(_Model): + """Fabric model update. + + :ivar tags: Gets or sets the resource tags. + :vartype tags: dict[str, str] + :ivar properties: Fabric model properties. + :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelProperties + :ivar id: Gets or sets the Id of the resource. + :vartype id: str + :ivar name: Gets or sets the name of the resource. + :vartype name: str + :ivar type: Gets or sets the type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.recoveryservicesdatareplication.models.SystemData + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the resource tags.""" + properties: Optional["_models.FabricModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric model properties.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the Id of the resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the type of the resource.""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Metadata pertaining to creation and last modification of the resource.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.FabricModelProperties"] = 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 JobModelCustomProperties(_Model): + """Job model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FailoverJobModelCustomProperties, TestFailoverCleanupJobModelCustomProperties, + TestFailoverJobModelCustomProperties + + :ivar instance_type: Discriminator property for JobModelCustomProperties. Required. Default + value is None. + :vartype instance_type: str + :ivar affected_object_details: Gets or sets any custom properties of the affected object. + :vartype affected_object_details: + ~azure.mgmt.recoveryservicesdatareplication.models.JobModelCustomPropertiesAffectedObjectDetails + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for JobModelCustomProperties. Required. Default value is None.""" + affected_object_details: Optional["_models.JobModelCustomPropertiesAffectedObjectDetails"] = rest_field( + name="affectedObjectDetails", visibility=["read"] + ) + """Gets or sets any custom properties of the affected object.""" + + @overload + def __init__( + self, + *, + instance_type: 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 FailoverJobModelCustomProperties(JobModelCustomProperties, discriminator="FailoverJobDetails"): + """Failover job model custom properties. + + :ivar affected_object_details: Gets or sets any custom properties of the affected object. + :vartype affected_object_details: + ~azure.mgmt.recoveryservicesdatareplication.models.JobModelCustomPropertiesAffectedObjectDetails + :ivar protected_item_details: Gets or sets the failed over protected item details. + :vartype protected_item_details: + list[~azure.mgmt.recoveryservicesdatareplication.models.FailoverProtectedItemProperties] + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "FailoverJobDetails". + :vartype instance_type: str + """ + + protected_item_details: Optional[List["_models.FailoverProtectedItemProperties"]] = rest_field( + name="protectedItemDetails", visibility=["read"] + ) + """Gets or sets the failed over protected item details.""" + instance_type: Literal["FailoverJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"FailoverJobDetails\".""" + + @overload + def __init__( + self, + ) -> 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, instance_type="FailoverJobDetails", **kwargs) + + +class FailoverProtectedItemProperties(_Model): + """Failover properties of the protected item. + + :ivar protected_item_name: Gets or sets the protected item name. + :vartype protected_item_name: str + :ivar vm_name: Gets or sets the VM name. + :vartype vm_name: str + :ivar test_vm_name: Gets or sets the test VM name. + :vartype test_vm_name: str + :ivar recovery_point_id: Gets or sets the recovery point Id. + :vartype recovery_point_id: str + :ivar recovery_point_time: Gets or sets the recovery point time. + :vartype recovery_point_time: ~datetime.datetime + :ivar network_name: Gets or sets the network name. + :vartype network_name: str + :ivar subnet: Gets or sets the network subnet. + :vartype subnet: str + """ + + protected_item_name: Optional[str] = rest_field(name="protectedItemName", visibility=["read"]) + """Gets or sets the protected item name.""" + vm_name: Optional[str] = rest_field(name="vmName", visibility=["read"]) + """Gets or sets the VM name.""" + test_vm_name: Optional[str] = rest_field(name="testVmName", visibility=["read"]) + """Gets or sets the test VM name.""" + recovery_point_id: Optional[str] = rest_field(name="recoveryPointId", visibility=["read"]) + """Gets or sets the recovery point Id.""" + recovery_point_time: Optional[datetime.datetime] = rest_field( + name="recoveryPointTime", visibility=["read"], format="rfc3339" + ) + """Gets or sets the recovery point time.""" + network_name: Optional[str] = rest_field(name="networkName", visibility=["read"]) + """Gets or sets the network name.""" + subnet: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the network subnet.""" + + +class GroupConnectivityInformation(_Model): + """Represents of a connection's group information. + + :ivar group_id: Gets or sets group id. + :vartype group_id: str + :ivar member_name: Gets or sets member name. + :vartype member_name: str + :ivar customer_visible_fqdns: Gets or sets customer visible FQDNs. + :vartype customer_visible_fqdns: list[str] + :ivar internal_fqdn: Gets or sets Internal Fqdn. + :vartype internal_fqdn: str + :ivar redirect_map_id: Gets or sets the redirect map id. + :vartype redirect_map_id: str + :ivar private_link_service_arm_region: Gets or sets the private link service arm region. + :vartype private_link_service_arm_region: str + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets group id.""" + member_name: Optional[str] = rest_field( + name="memberName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets member name.""" + customer_visible_fqdns: Optional[List[str]] = rest_field( + name="customerVisibleFqdns", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets customer visible FQDNs.""" + internal_fqdn: Optional[str] = rest_field( + name="internalFqdn", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets Internal Fqdn.""" + redirect_map_id: Optional[str] = rest_field( + name="redirectMapId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the redirect map id.""" + private_link_service_arm_region: Optional[str] = rest_field( + name="privateLinkServiceArmRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the private link service arm region.""" + + @overload + def __init__( + self, + *, + group_id: Optional[str] = None, + member_name: Optional[str] = None, + customer_visible_fqdns: Optional[List[str]] = None, + internal_fqdn: Optional[str] = None, + redirect_map_id: Optional[str] = None, + private_link_service_arm_region: 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 HealthErrorModel(_Model): + """Health error model. + + :ivar affected_resource_type: Gets or sets the type of affected resource type. + :vartype affected_resource_type: str + :ivar affected_resource_correlation_ids: Gets or sets the list of affected resource correlation + Ids. This can be used to uniquely identify the count of items affected by a specific category + and severity as well as count of item affected by an specific issue. + :vartype affected_resource_correlation_ids: list[str] + :ivar child_errors: Gets or sets a list of child health errors associated with this error. + :vartype child_errors: + list[~azure.mgmt.recoveryservicesdatareplication.models.InnerHealthErrorModel] + :ivar code: Gets or sets the error code. + :vartype code: str + :ivar health_category: Gets or sets the health category. + :vartype health_category: str + :ivar category: Gets or sets the error category. + :vartype category: str + :ivar severity: Gets or sets the error severity. + :vartype severity: str + :ivar source: Gets or sets the error source. + :vartype source: str + :ivar creation_time: Gets or sets the error creation time. + :vartype creation_time: ~datetime.datetime + :ivar is_customer_resolvable: Gets or sets a value indicating whether the error is customer + resolvable. + :vartype is_customer_resolvable: bool + :ivar summary: Gets or sets the error summary. + :vartype summary: str + :ivar message: Gets or sets the error message. + :vartype message: str + :ivar causes: Gets or sets possible causes of the error. + :vartype causes: str + :ivar recommendation: Gets or sets recommended action to resolve the error. + :vartype recommendation: str + """ + + affected_resource_type: Optional[str] = rest_field( + name="affectedResourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of affected resource type.""" + affected_resource_correlation_ids: Optional[List[str]] = rest_field( + name="affectedResourceCorrelationIds", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of affected resource correlation Ids. This can be used to uniquely + identify the count of items affected by a specific category and severity as well as count of + item affected by an specific issue.""" + child_errors: Optional[List["_models.InnerHealthErrorModel"]] = rest_field( + name="childErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a list of child health errors associated with this error.""" + code: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error code.""" + health_category: Optional[str] = rest_field(name="healthCategory", visibility=["read"]) + """Gets or sets the health category.""" + category: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error category.""" + severity: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error severity.""" + source: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error source.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Gets or sets the error creation time.""" + is_customer_resolvable: Optional[bool] = rest_field(name="isCustomerResolvable", visibility=["read"]) + """Gets or sets a value indicating whether the error is customer resolvable.""" + summary: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error summary.""" + message: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error message.""" + causes: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets possible causes of the error.""" + recommendation: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets recommended action to resolve the error.""" + + @overload + def __init__( + self, + *, + affected_resource_type: Optional[str] = None, + affected_resource_correlation_ids: Optional[List[str]] = None, + child_errors: Optional[List["_models.InnerHealthErrorModel"]] = 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 HyperVMigrateFabricModelCustomProperties(FabricModelCustomProperties, discriminator="HyperVMigrate"): + """HyperV migrate fabric model custom properties. + + :ivar hyper_v_site_id: Gets or sets the ARM Id of the HyperV site. Required. + :vartype hyper_v_site_id: str + :ivar fabric_resource_id: Gets or sets the fabric resource Id. + :vartype fabric_resource_id: str + :ivar fabric_container_id: Gets or sets the fabric container Id. + :vartype fabric_container_id: str + :ivar migration_solution_id: Gets or sets the migration solution ARM Id. Required. + :vartype migration_solution_id: str + :ivar migration_hub_uri: Gets or sets the migration hub Uri. + :vartype migration_hub_uri: str + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "HyperVMigrate". + :vartype instance_type: str + """ + + hyper_v_site_id: str = rest_field(name="hyperVSiteId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the ARM Id of the HyperV site. Required.""" + fabric_resource_id: Optional[str] = rest_field(name="fabricResourceId", visibility=["read"]) + """Gets or sets the fabric resource Id.""" + fabric_container_id: Optional[str] = rest_field(name="fabricContainerId", visibility=["read"]) + """Gets or sets the fabric container Id.""" + migration_solution_id: str = rest_field( + name="migrationSolutionId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the migration solution ARM Id. Required.""" + migration_hub_uri: Optional[str] = rest_field(name="migrationHubUri", visibility=["read"]) + """Gets or sets the migration hub Uri.""" + instance_type: Literal["HyperVMigrate"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"HyperVMigrate\".""" + + @overload + def __init__( + self, + *, + hyper_v_site_id: str, + migration_solution_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, instance_type="HyperVMigrate", **kwargs) + + +class HyperVToAzStackHCIDiskInput(_Model): + """HyperVToAzStack disk input. + + :ivar disk_id: Gets or sets the disk Id. Required. + :vartype disk_id: str + :ivar storage_container_id: Gets or sets the target storage account ARM Id. + :vartype storage_container_id: str + :ivar is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the + virtual hard disk. + :vartype is_dynamic: bool + :ivar disk_size_gb: Gets or sets the disk size in GB. Required. + :vartype disk_size_gb: int + :ivar disk_file_format: Gets or sets the type of the virtual hard disk, vhd or vhdx. Required. + :vartype disk_file_format: str + :ivar is_os_disk: Gets or sets a value indicating whether disk is os disk. Required. + :vartype is_os_disk: bool + :ivar disk_block_size: Gets or sets a value of disk block size. + :vartype disk_block_size: int + :ivar disk_logical_sector_size: Gets or sets a value of disk logical sector size. + :vartype disk_logical_sector_size: int + :ivar disk_physical_sector_size: Gets or sets a value of disk physical sector size. + :vartype disk_physical_sector_size: int + :ivar disk_identifier: Gets or sets a value of disk identifier. + :vartype disk_identifier: str + :ivar disk_controller: Disk controller. + :vartype disk_controller: + ~azure.mgmt.recoveryservicesdatareplication.models.DiskControllerInputs + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the disk Id. Required.""" + storage_container_id: Optional[str] = rest_field( + name="storageContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target storage account ARM Id.""" + is_dynamic: Optional[bool] = rest_field( + name="isDynamic", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk.""" + disk_size_gb: int = rest_field(name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the disk size in GB. Required.""" + disk_file_format: str = rest_field( + name="diskFileFormat", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of the virtual hard disk, vhd or vhdx. Required.""" + is_os_disk: bool = rest_field(name="isOsDisk", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets a value indicating whether disk is os disk. Required.""" + disk_block_size: Optional[int] = rest_field( + name="diskBlockSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value of disk block size.""" + disk_logical_sector_size: Optional[int] = rest_field( + name="diskLogicalSectorSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value of disk logical sector size.""" + disk_physical_sector_size: Optional[int] = rest_field( + name="diskPhysicalSectorSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value of disk physical sector size.""" + disk_identifier: Optional[str] = rest_field( + name="diskIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value of disk identifier.""" + disk_controller: Optional["_models.DiskControllerInputs"] = rest_field( + name="diskController", visibility=["read", "create", "update", "delete", "query"] + ) + """Disk controller.""" + + @overload + def __init__( + self, + *, + disk_id: str, + disk_size_gb: int, + disk_file_format: str, + is_os_disk: bool, + storage_container_id: Optional[str] = None, + is_dynamic: Optional[bool] = None, + disk_block_size: Optional[int] = None, + disk_logical_sector_size: Optional[int] = None, + disk_physical_sector_size: Optional[int] = None, + disk_identifier: Optional[str] = None, + disk_controller: Optional["_models.DiskControllerInputs"] = 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 HyperVToAzStackHCIEventModelCustomProperties( + EventModelCustomProperties, discriminator="HyperVToAzStackHCI" +): # pylint: disable=name-too-long + """HyperV to AzStackHCI event model custom properties. This class provides provider specific + details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and + DataContract.HealthEvents.HealthEventType.AgentHealth. + + :ivar event_source_friendly_name: Gets or sets the friendly name of the source which has raised + this health event. + :vartype event_source_friendly_name: str + :ivar protected_item_friendly_name: Gets or sets the protected item friendly name. + :vartype protected_item_friendly_name: str + :ivar source_appliance_name: Gets or sets the source appliance name. + :vartype source_appliance_name: str + :ivar target_appliance_name: Gets or sets the source target name. + :vartype target_appliance_name: str + :ivar server_type: Gets or sets the server type. + :vartype server_type: str + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "HyperVToAzStackHCI". + :vartype instance_type: str + """ + + event_source_friendly_name: Optional[str] = rest_field(name="eventSourceFriendlyName", visibility=["read"]) + """Gets or sets the friendly name of the source which has raised this health event.""" + protected_item_friendly_name: Optional[str] = rest_field(name="protectedItemFriendlyName", visibility=["read"]) + """Gets or sets the protected item friendly name.""" + source_appliance_name: Optional[str] = rest_field(name="sourceApplianceName", visibility=["read"]) + """Gets or sets the source appliance name.""" + target_appliance_name: Optional[str] = rest_field(name="targetApplianceName", visibility=["read"]) + """Gets or sets the source target name.""" + server_type: Optional[str] = rest_field(name="serverType", visibility=["read"]) + """Gets or sets the server type.""" + instance_type: Literal["HyperVToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"HyperVToAzStackHCI\".""" + + @overload + def __init__( + self, + ) -> 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, instance_type="HyperVToAzStackHCI", **kwargs) + + +class HyperVToAzStackHCINicInput(_Model): + """HyperVToAzStackHCI NIC properties. + + :ivar nic_id: Gets or sets the NIC Id. Required. + :vartype nic_id: str + :ivar network_name: Gets or sets the network name. + :vartype network_name: str + :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. + :vartype target_network_id: str + :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. + :vartype test_network_id: str + :ivar selection_type_for_failover: Gets or sets the selection type of the NIC. Required. Known + values are: "NotSelected", "SelectedByUser", "SelectedByDefault", and "SelectedByUserOverride". + :vartype selection_type_for_failover: str or + ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection + :ivar is_static_ip_migration_enabled: Gets or sets a value indicating whether static ip + migration is enabled. + :vartype is_static_ip_migration_enabled: bool + :ivar is_mac_migration_enabled: Gets or sets a value indicating whether mac address migration + is enabled. + :vartype is_mac_migration_enabled: bool + """ + + nic_id: str = rest_field(name="nicId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the NIC Id. Required.""" + network_name: Optional[str] = rest_field(name="networkName", visibility=["read"]) + """Gets or sets the network name.""" + target_network_id: Optional[str] = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target network Id within AzStackHCI Cluster.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target test network Id within AzStackHCI Cluster.""" + selection_type_for_failover: Union[str, "_models.VMNicSelection"] = rest_field( + name="selectionTypeForFailover", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the selection type of the NIC. Required. Known values are: \"NotSelected\", + \"SelectedByUser\", \"SelectedByDefault\", and \"SelectedByUserOverride\".""" + is_static_ip_migration_enabled: Optional[bool] = rest_field( + name="isStaticIpMigrationEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether static ip migration is enabled.""" + is_mac_migration_enabled: Optional[bool] = rest_field( + name="isMacMigrationEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether mac address migration is enabled.""" + + @overload + def __init__( + self, + *, + nic_id: str, + selection_type_for_failover: Union[str, "_models.VMNicSelection"], + target_network_id: Optional[str] = None, + test_network_id: Optional[str] = None, + is_static_ip_migration_enabled: Optional[bool] = None, + is_mac_migration_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 PlannedFailoverModelCustomProperties(_Model): + """Planned failover model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVToAzStackHCIPlannedFailoverModelCustomProperties, + VMwareToAzStackHCIPlannedFailoverModelCustomProperties + + :ivar instance_type: Discriminator property for PlannedFailoverModelCustomProperties. Required. + Default value is None. + :vartype instance_type: str + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for PlannedFailoverModelCustomProperties. Required. Default value is + None.""" + + @overload + def __init__( + self, + *, + instance_type: 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 HyperVToAzStackHCIPlannedFailoverModelCustomProperties( + PlannedFailoverModelCustomProperties, discriminator="HyperVToAzStackHCI" +): # pylint: disable=name-too-long + """HyperV to AzStackHCI planned failover model custom properties. + + :ivar shutdown_source_vm: Gets or sets a value indicating whether VM needs to be shut down. + Required. + :vartype shutdown_source_vm: bool + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "HyperVToAzStackHCI". + :vartype instance_type: str + """ + + shutdown_source_vm: bool = rest_field( + name="shutdownSourceVM", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether VM needs to be shut down. Required.""" + instance_type: Literal["HyperVToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"HyperVToAzStackHCI\".""" + + @overload + def __init__( + self, + *, + shutdown_source_vm: bool, + ) -> 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, instance_type="HyperVToAzStackHCI", **kwargs) + + +class PolicyModelCustomProperties(_Model): + """Policy model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVToAzStackHCIPolicyModelCustomProperties, VMwareToAzStackHCIPolicyModelCustomProperties + + :ivar instance_type: Discriminator property for PolicyModelCustomProperties. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for PolicyModelCustomProperties. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: 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 HyperVToAzStackHCIPolicyModelCustomProperties( + PolicyModelCustomProperties, discriminator="HyperVToAzStackHCI" +): # pylint: disable=name-too-long + """HyperV To AzStackHCI Policy model custom properties. + + :ivar recovery_point_history_in_minutes: Gets or sets the duration in minutes until which the + recovery points need to be stored. Required. + :vartype recovery_point_history_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: Gets or sets the crash consistent snapshot + frequency (in minutes). Required. + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: Gets or sets the app consistent snapshot frequency + (in minutes). Required. + :vartype app_consistent_frequency_in_minutes: int + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "HyperVToAzStackHCI". + :vartype instance_type: str + """ + + recovery_point_history_in_minutes: int = rest_field( + name="recoveryPointHistoryInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the duration in minutes until which the recovery points need to be stored. + Required.""" + crash_consistent_frequency_in_minutes: int = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the crash consistent snapshot frequency (in minutes). Required.""" + app_consistent_frequency_in_minutes: int = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the app consistent snapshot frequency (in minutes). Required.""" + instance_type: Literal["HyperVToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"HyperVToAzStackHCI\".""" + + @overload + def __init__( + self, + *, + recovery_point_history_in_minutes: int, + crash_consistent_frequency_in_minutes: int, + app_consistent_frequency_in_minutes: 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, instance_type="HyperVToAzStackHCI", **kwargs) + + +class HyperVToAzStackHCIProtectedDiskProperties(_Model): # pylint: disable=name-too-long + """HyperVToAzStackHCI protected disk properties. + + :ivar storage_container_id: Gets or sets the ARM Id of the storage container. + :vartype storage_container_id: str + :ivar storage_container_local_path: Gets or sets the local path of the storage container. + :vartype storage_container_local_path: str + :ivar source_disk_id: Gets or sets the source disk Id. + :vartype source_disk_id: str + :ivar source_disk_name: Gets or sets the source disk Name. + :vartype source_disk_name: str + :ivar seed_disk_name: Gets or sets the seed disk name. + :vartype seed_disk_name: str + :ivar test_migrate_disk_name: Gets or sets the test failover clone disk. + :vartype test_migrate_disk_name: str + :ivar migrate_disk_name: Gets or sets the failover clone disk. + :vartype migrate_disk_name: str + :ivar is_os_disk: Gets or sets a value indicating whether the disk is the OS disk. + :vartype is_os_disk: bool + :ivar capacity_in_bytes: Gets or sets the disk capacity in bytes. + :vartype capacity_in_bytes: int + :ivar is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the + virtual hard disk. + :vartype is_dynamic: bool + :ivar disk_type: Gets or sets the disk type. + :vartype disk_type: str + :ivar disk_block_size: Gets or sets a value of disk block size. + :vartype disk_block_size: int + :ivar disk_logical_sector_size: Gets or sets a value of disk logical sector size. + :vartype disk_logical_sector_size: int + :ivar disk_physical_sector_size: Gets or sets a value of disk physical sector size. + :vartype disk_physical_sector_size: int + """ + + storage_container_id: Optional[str] = rest_field(name="storageContainerId", visibility=["read"]) + """Gets or sets the ARM Id of the storage container.""" + storage_container_local_path: Optional[str] = rest_field(name="storageContainerLocalPath", visibility=["read"]) + """Gets or sets the local path of the storage container.""" + source_disk_id: Optional[str] = rest_field(name="sourceDiskId", visibility=["read"]) + """Gets or sets the source disk Id.""" + source_disk_name: Optional[str] = rest_field(name="sourceDiskName", visibility=["read"]) + """Gets or sets the source disk Name.""" + seed_disk_name: Optional[str] = rest_field(name="seedDiskName", visibility=["read"]) + """Gets or sets the seed disk name.""" + test_migrate_disk_name: Optional[str] = rest_field(name="testMigrateDiskName", visibility=["read"]) + """Gets or sets the test failover clone disk.""" + migrate_disk_name: Optional[str] = rest_field(name="migrateDiskName", visibility=["read"]) + """Gets or sets the failover clone disk.""" + is_os_disk: Optional[bool] = rest_field(name="isOsDisk", visibility=["read"]) + """Gets or sets a value indicating whether the disk is the OS disk.""" + capacity_in_bytes: Optional[int] = rest_field(name="capacityInBytes", visibility=["read"]) + """Gets or sets the disk capacity in bytes.""" + is_dynamic: Optional[bool] = rest_field(name="isDynamic", visibility=["read"]) + """Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk.""" + disk_type: Optional[str] = rest_field(name="diskType", visibility=["read"]) + """Gets or sets the disk type.""" + disk_block_size: Optional[int] = rest_field(name="diskBlockSize", visibility=["read"]) + """Gets or sets a value of disk block size.""" + disk_logical_sector_size: Optional[int] = rest_field(name="diskLogicalSectorSize", visibility=["read"]) + """Gets or sets a value of disk logical sector size.""" + disk_physical_sector_size: Optional[int] = rest_field(name="diskPhysicalSectorSize", visibility=["read"]) + """Gets or sets a value of disk physical sector size.""" + + +class ProtectedItemModelCustomProperties(_Model): + """Protected item model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVToAzStackHCIProtectedItemModelCustomProperties, + VMwareToAzStackHCIProtectedItemModelCustomProperties + + :ivar instance_type: Discriminator property for ProtectedItemModelCustomProperties. Required. + Default value is None. + :vartype instance_type: str + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for ProtectedItemModelCustomProperties. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: 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 HyperVToAzStackHCIProtectedItemModelCustomProperties( + ProtectedItemModelCustomProperties, discriminator="HyperVToAzStackHCI" +): # pylint: disable=name-too-long + """HyperV to AzStackHCI Protected item model custom properties. + + :ivar active_location: Gets or sets the location of the protected item. Known values are: + "Primary" and "Recovery". + :vartype active_location: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemActiveLocation + :ivar target_hci_cluster_id: Gets or sets the Target HCI Cluster ARM Id. Required. + :vartype target_hci_cluster_id: str + :ivar target_arc_cluster_custom_location_id: Gets or sets the Target Arc Cluster Custom + Location ARM Id. Required. + :vartype target_arc_cluster_custom_location_id: str + :ivar target_az_stack_hci_cluster_name: Gets or sets the Target AzStackHCI cluster name. + :vartype target_az_stack_hci_cluster_name: str + :ivar fabric_discovery_machine_id: Gets or sets the ARM Id of the discovered machine. Required. + :vartype fabric_discovery_machine_id: str + :ivar disks_to_include: Gets or sets the list of disks to replicate. Required. + :vartype disks_to_include: + list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIDiskInput] + :ivar nics_to_include: Gets or sets the list of VM NIC to replicate. Required. + :vartype nics_to_include: + list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCINicInput] + :ivar source_vm_name: Gets or sets the source VM display name. + :vartype source_vm_name: str + :ivar source_cpu_cores: Gets or sets the source VM CPU cores. + :vartype source_cpu_cores: int + :ivar source_memory_in_mega_bytes: Gets or sets the source VM ram memory size in megabytes. + :vartype source_memory_in_mega_bytes: float + :ivar target_vm_name: Gets or sets the target VM display name. + :vartype target_vm_name: str + :ivar target_resource_group_id: Gets or sets the target resource group ARM Id. Required. + :vartype target_resource_group_id: str + :ivar storage_container_id: Gets or sets the target storage container ARM Id. Required. + :vartype storage_container_id: str + :ivar hyper_v_generation: Gets or sets the hypervisor generation of the virtual machine. + Required. + :vartype hyper_v_generation: str + :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. + :vartype target_network_id: str + :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. + :vartype test_network_id: str + :ivar target_cpu_cores: Gets or sets the target CPU cores. + :vartype target_cpu_cores: int + :ivar is_dynamic_ram: Gets or sets a value indicating whether memory is dynamical. + :vartype is_dynamic_ram: bool + :ivar dynamic_memory_config: Protected item dynamic memory config. + :vartype dynamic_memory_config: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemDynamicMemoryConfig + :ivar target_memory_in_mega_bytes: Gets or sets the target memory in mega-bytes. + :vartype target_memory_in_mega_bytes: int + :ivar run_as_account_id: Gets or sets the Run As account Id. Required. + :vartype run_as_account_id: str + :ivar source_fabric_agent_name: Gets or sets the source fabric agent name. Required. + :vartype source_fabric_agent_name: str + :ivar target_fabric_agent_name: Gets or sets the target fabric agent name. Required. + :vartype target_fabric_agent_name: str + :ivar source_appliance_name: Gets or sets the source appliance name. + :vartype source_appliance_name: str + :ivar target_appliance_name: Gets or sets the target appliance name. + :vartype target_appliance_name: str + :ivar os_type: Gets or sets the type of the OS. + :vartype os_type: str + :ivar os_name: Gets or sets the name of the OS. + :vartype os_name: str + :ivar firmware_type: Gets or sets the firmware type. + :vartype firmware_type: str + :ivar target_location: Gets or sets the target location. + :vartype target_location: str + :ivar custom_location_region: Gets or sets the location of Azure Arc HCI custom location + resource. Required. + :vartype custom_location_region: str + :ivar failover_recovery_point_id: Gets or sets the recovery point Id to which the VM was failed + over. + :vartype failover_recovery_point_id: str + :ivar last_recovery_point_received: Gets or sets the last recovery point received time. + :vartype last_recovery_point_received: ~datetime.datetime + :ivar last_recovery_point_id: Gets or sets the last recovery point Id. + :vartype last_recovery_point_id: str + :ivar initial_replication_progress_percentage: Gets or sets the initial replication progress + percentage. This is calculated based on total bytes processed for all disks in the source VM. + :vartype initial_replication_progress_percentage: int + :ivar resync_progress_percentage: Gets or sets the resync progress percentage. This is + calculated based on total bytes processed for all disks in the source VM. + :vartype resync_progress_percentage: int + :ivar protected_disks: Gets or sets the list of protected disks. + :vartype protected_disks: + list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIProtectedDiskProperties] + :ivar protected_nics: Gets or sets the VM NIC details. + :vartype protected_nics: + list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIProtectedNicProperties] + :ivar target_vm_bios_id: Gets or sets the BIOS Id of the target AzStackHCI VM. + :vartype target_vm_bios_id: str + :ivar last_replication_update_time: Gets or sets the latest timestamp that replication status + is updated. + :vartype last_replication_update_time: ~datetime.datetime + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "HyperVToAzStackHCI". + :vartype instance_type: str + """ + + active_location: Optional[Union[str, "_models.ProtectedItemActiveLocation"]] = rest_field( + name="activeLocation", visibility=["read"] + ) + """Gets or sets the location of the protected item. Known values are: \"Primary\" and + \"Recovery\".""" + target_hci_cluster_id: str = rest_field( + name="targetHciClusterId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Target HCI Cluster ARM Id. Required.""" + target_arc_cluster_custom_location_id: str = rest_field( + name="targetArcClusterCustomLocationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Target Arc Cluster Custom Location ARM Id. Required.""" + target_az_stack_hci_cluster_name: Optional[str] = rest_field( + name="targetAzStackHciClusterName", visibility=["read"] + ) + """Gets or sets the Target AzStackHCI cluster name.""" + fabric_discovery_machine_id: str = rest_field( + name="fabricDiscoveryMachineId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ARM Id of the discovered machine. Required.""" + disks_to_include: List["_models.HyperVToAzStackHCIDiskInput"] = rest_field( + name="disksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of disks to replicate. Required.""" + nics_to_include: List["_models.HyperVToAzStackHCINicInput"] = rest_field( + name="nicsToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of VM NIC to replicate. Required.""" + source_vm_name: Optional[str] = rest_field(name="sourceVmName", visibility=["read"]) + """Gets or sets the source VM display name.""" + source_cpu_cores: Optional[int] = rest_field(name="sourceCpuCores", visibility=["read"]) + """Gets or sets the source VM CPU cores.""" + source_memory_in_mega_bytes: Optional[float] = rest_field(name="sourceMemoryInMegaBytes", visibility=["read"]) + """Gets or sets the source VM ram memory size in megabytes.""" + target_vm_name: Optional[str] = rest_field( + name="targetVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target VM display name.""" + target_resource_group_id: str = rest_field( + name="targetResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target resource group ARM Id. Required.""" + storage_container_id: str = rest_field( + name="storageContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target storage container ARM Id. Required.""" + hyper_v_generation: str = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the hypervisor generation of the virtual machine. Required.""" + target_network_id: Optional[str] = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target network Id within AzStackHCI Cluster.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target test network Id within AzStackHCI Cluster.""" + target_cpu_cores: Optional[int] = rest_field( + name="targetCpuCores", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target CPU cores.""" + is_dynamic_ram: Optional[bool] = rest_field( + name="isDynamicRam", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether memory is dynamical.""" + dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = rest_field( + name="dynamicMemoryConfig", visibility=["read", "create", "update", "delete", "query"] + ) + """Protected item dynamic memory config.""" + target_memory_in_mega_bytes: Optional[int] = rest_field( + name="targetMemoryInMegaBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target memory in mega-bytes.""" + run_as_account_id: str = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Run As account Id. Required.""" + source_fabric_agent_name: str = rest_field( + name="sourceFabricAgentName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the source fabric agent name. Required.""" + target_fabric_agent_name: str = rest_field( + name="targetFabricAgentName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target fabric agent name. Required.""" + source_appliance_name: Optional[str] = rest_field(name="sourceApplianceName", visibility=["read"]) + """Gets or sets the source appliance name.""" + target_appliance_name: Optional[str] = rest_field(name="targetApplianceName", visibility=["read"]) + """Gets or sets the target appliance name.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read"]) + """Gets or sets the type of the OS.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read"]) + """Gets or sets the name of the OS.""" + firmware_type: Optional[str] = rest_field(name="firmwareType", visibility=["read"]) + """Gets or sets the firmware type.""" + target_location: Optional[str] = rest_field(name="targetLocation", visibility=["read"]) + """Gets or sets the target location.""" + custom_location_region: str = rest_field( + name="customLocationRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the location of Azure Arc HCI custom location resource. Required.""" + failover_recovery_point_id: Optional[str] = rest_field(name="failoverRecoveryPointId", visibility=["read"]) + """Gets or sets the recovery point Id to which the VM was failed over.""" + last_recovery_point_received: Optional[datetime.datetime] = rest_field( + name="lastRecoveryPointReceived", visibility=["read"], format="rfc3339" + ) + """Gets or sets the last recovery point received time.""" + last_recovery_point_id: Optional[str] = rest_field(name="lastRecoveryPointId", visibility=["read"]) + """Gets or sets the last recovery point Id.""" + initial_replication_progress_percentage: Optional[int] = rest_field( + name="initialReplicationProgressPercentage", visibility=["read"] + ) + """Gets or sets the initial replication progress percentage. This is calculated based on total + bytes processed for all disks in the source VM.""" + resync_progress_percentage: Optional[int] = rest_field(name="resyncProgressPercentage", visibility=["read"]) + """Gets or sets the resync progress percentage. This is calculated based on total bytes processed + for all disks in the source VM.""" + protected_disks: Optional[List["_models.HyperVToAzStackHCIProtectedDiskProperties"]] = rest_field( + name="protectedDisks", visibility=["read"] + ) + """Gets or sets the list of protected disks.""" + protected_nics: Optional[List["_models.HyperVToAzStackHCIProtectedNicProperties"]] = rest_field( + name="protectedNics", visibility=["read"] + ) + """Gets or sets the VM NIC details.""" + target_vm_bios_id: Optional[str] = rest_field(name="targetVmBiosId", visibility=["read"]) + """Gets or sets the BIOS Id of the target AzStackHCI VM.""" + last_replication_update_time: Optional[datetime.datetime] = rest_field( + name="lastReplicationUpdateTime", visibility=["read"], format="rfc3339" + ) + """Gets or sets the latest timestamp that replication status is updated.""" + instance_type: Literal["HyperVToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"HyperVToAzStackHCI\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + target_hci_cluster_id: str, + target_arc_cluster_custom_location_id: str, + fabric_discovery_machine_id: str, + disks_to_include: List["_models.HyperVToAzStackHCIDiskInput"], + nics_to_include: List["_models.HyperVToAzStackHCINicInput"], + target_resource_group_id: str, + storage_container_id: str, + hyper_v_generation: str, + run_as_account_id: str, + source_fabric_agent_name: str, + target_fabric_agent_name: str, + custom_location_region: str, + target_vm_name: Optional[str] = None, + target_network_id: Optional[str] = None, + test_network_id: Optional[str] = None, + target_cpu_cores: Optional[int] = None, + is_dynamic_ram: Optional[bool] = None, + dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = None, + target_memory_in_mega_bytes: 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, instance_type="HyperVToAzStackHCI", **kwargs) + + +class ProtectedItemModelCustomPropertiesUpdate(_Model): + """Protected item model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate, + VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate + + :ivar instance_type: Discriminator property for ProtectedItemModelCustomPropertiesUpdate. + Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for ProtectedItemModelCustomPropertiesUpdate. Required. Default value is + None.""" + + @overload + def __init__( + self, + *, + instance_type: 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 HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate( + ProtectedItemModelCustomPropertiesUpdate, discriminator="HyperVToAzStackHCI" +): # pylint: disable=name-too-long + """HyperV to AzStackHCI Protected item model custom properties. + + :ivar nics_to_include: Gets or sets the list of VM NIC to replicate. + :vartype nics_to_include: + list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCINicInput] + :ivar target_cpu_cores: Gets or sets the target CPU cores. + :vartype target_cpu_cores: int + :ivar is_dynamic_ram: Gets or sets a value indicating whether memory is dynamical. + :vartype is_dynamic_ram: bool + :ivar dynamic_memory_config: Protected item dynamic memory config. + :vartype dynamic_memory_config: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemDynamicMemoryConfig + :ivar target_memory_in_mega_bytes: Gets or sets the target memory in mega-bytes. + :vartype target_memory_in_mega_bytes: int + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "HyperVToAzStackHCI". + :vartype instance_type: str + :ivar os_type: Gets or sets the type of the OS. + :vartype os_type: str + """ + + nics_to_include: Optional[List["_models.HyperVToAzStackHCINicInput"]] = rest_field( + name="nicsToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of VM NIC to replicate.""" + target_cpu_cores: Optional[int] = rest_field( + name="targetCpuCores", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target CPU cores.""" + is_dynamic_ram: Optional[bool] = rest_field( + name="isDynamicRam", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether memory is dynamical.""" + dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = rest_field( + name="dynamicMemoryConfig", visibility=["read", "create", "update", "delete", "query"] + ) + """Protected item dynamic memory config.""" + target_memory_in_mega_bytes: Optional[int] = rest_field( + name="targetMemoryInMegaBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target memory in mega-bytes.""" + instance_type: Literal["HyperVToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"HyperVToAzStackHCI\".""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the type of the OS.""" + + @overload + def __init__( + self, + *, + nics_to_include: Optional[List["_models.HyperVToAzStackHCINicInput"]] = None, + target_cpu_cores: Optional[int] = None, + is_dynamic_ram: Optional[bool] = None, + dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = None, + target_memory_in_mega_bytes: Optional[int] = None, + os_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, instance_type="HyperVToAzStackHCI", **kwargs) + + +class HyperVToAzStackHCIProtectedNicProperties(_Model): + """HyperVToAzStackHCI NIC properties. + + :ivar nic_id: Gets or sets the NIC Id. + :vartype nic_id: str + :ivar mac_address: Gets or sets the NIC mac address. + :vartype mac_address: str + :ivar network_name: Gets or sets the network name. + :vartype network_name: str + :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. + :vartype target_network_id: str + :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. + :vartype test_network_id: str + :ivar selection_type_for_failover: Gets or sets the selection type of the NIC. Known values + are: "NotSelected", "SelectedByUser", "SelectedByDefault", and "SelectedByUserOverride". + :vartype selection_type_for_failover: str or + ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection + """ + + nic_id: Optional[str] = rest_field(name="nicId", visibility=["read"]) + """Gets or sets the NIC Id.""" + mac_address: Optional[str] = rest_field(name="macAddress", visibility=["read"]) + """Gets or sets the NIC mac address.""" + network_name: Optional[str] = rest_field(name="networkName", visibility=["read"]) + """Gets or sets the network name.""" + target_network_id: Optional[str] = rest_field(name="targetNetworkId", visibility=["read"]) + """Gets or sets the target network Id within AzStackHCI Cluster.""" + test_network_id: Optional[str] = rest_field(name="testNetworkId", visibility=["read"]) + """Gets or sets the target test network Id within AzStackHCI Cluster.""" + selection_type_for_failover: Optional[Union[str, "_models.VMNicSelection"]] = rest_field( + name="selectionTypeForFailover", visibility=["read"] + ) + """Gets or sets the selection type of the NIC. Known values are: \"NotSelected\", + \"SelectedByUser\", \"SelectedByDefault\", and \"SelectedByUserOverride\".""" + + +class RecoveryPointModelCustomProperties(_Model): + """Recovery point model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVToAzStackHCIRecoveryPointModelCustomProperties, + VMwareToAzStackHCIRecoveryPointModelCustomProperties + + :ivar instance_type: Discriminator property for RecoveryPointModelCustomProperties. Required. + Default value is None. + :vartype instance_type: str + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for RecoveryPointModelCustomProperties. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: 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 HyperVToAzStackHCIRecoveryPointModelCustomProperties( + RecoveryPointModelCustomProperties, discriminator="HyperVToAzStackHCI" +): # pylint: disable=name-too-long + """HyperV to AzStackHCI recovery point model custom properties. + + :ivar disk_ids: Gets or sets the list of the disk Ids. + :vartype disk_ids: list[str] + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "HyperVToAzStackHCI". + :vartype instance_type: str + """ + + disk_ids: Optional[List[str]] = rest_field(name="diskIds", visibility=["read"]) + """Gets or sets the list of the disk Ids.""" + instance_type: Literal["HyperVToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"HyperVToAzStackHCI\".""" + + @overload + def __init__( + self, + ) -> 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, instance_type="HyperVToAzStackHCI", **kwargs) + + +class ReplicationExtensionModelCustomProperties(_Model): # pylint: disable=name-too-long + """Replication extension model custom properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVToAzStackHCIReplicationExtensionModelCustomProperties, + VMwareToAzStackHCIReplicationExtensionModelCustomProperties + + :ivar instance_type: Discriminator property for ReplicationExtensionModelCustomProperties. + Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: Dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType") + """Discriminator property for ReplicationExtensionModelCustomProperties. Required. Default value + is None.""" + + @overload + def __init__( + self, + *, + instance_type: 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 HyperVToAzStackHCIReplicationExtensionModelCustomProperties( + ReplicationExtensionModelCustomProperties, discriminator="HyperVToAzStackHCI" +): # pylint: disable=name-too-long + """HyperV to AzStackHCI Replication extension model custom properties. + + :ivar hyper_v_fabric_arm_id: Gets or sets the ARM Id of the source HyperV fabric. Required. + :vartype hyper_v_fabric_arm_id: str + :ivar hyper_v_site_id: Gets or sets the ARM Id of the HyperV site. + :vartype hyper_v_site_id: str + :ivar az_stack_hci_fabric_arm_id: Gets or sets the ARM Id of the target AzStackHCI fabric. + Required. + :vartype az_stack_hci_fabric_arm_id: str + :ivar az_stack_hci_site_id: Gets or sets the ARM Id of the AzStackHCI site. + :vartype az_stack_hci_site_id: str + :ivar storage_account_id: Gets or sets the storage account Id. + :vartype storage_account_id: str + :ivar storage_account_sas_secret_name: Gets or sets the Sas Secret of storage account. + :vartype storage_account_sas_secret_name: str + :ivar asr_service_uri: Gets or sets the Uri of ASR. + :vartype asr_service_uri: str + :ivar rcm_service_uri: Gets or sets the Uri of Rcm. + :vartype rcm_service_uri: str + :ivar gateway_service_uri: Gets or sets the Uri of Gateway. + :vartype gateway_service_uri: str + :ivar source_gateway_service_id: Gets or sets the gateway service Id of source. + :vartype source_gateway_service_id: str + :ivar target_gateway_service_id: Gets or sets the gateway service Id of target. + :vartype target_gateway_service_id: str + :ivar source_storage_container_name: Gets or sets the source storage container name. + :vartype source_storage_container_name: str + :ivar target_storage_container_name: Gets or sets the target storage container name. + :vartype target_storage_container_name: str + :ivar resource_location: Gets or sets the resource location. + :vartype resource_location: str + :ivar subscription_id: Gets or sets the subscription. + :vartype subscription_id: str + :ivar resource_group: Gets or sets the resource group. + :vartype resource_group: str + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "HyperVToAzStackHCI". + :vartype instance_type: str + """ + + hyper_v_fabric_arm_id: str = rest_field( + name="hyperVFabricArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ARM Id of the source HyperV fabric. Required.""" + hyper_v_site_id: Optional[str] = rest_field(name="hyperVSiteId", visibility=["read"]) + """Gets or sets the ARM Id of the HyperV site.""" + az_stack_hci_fabric_arm_id: str = rest_field( + name="azStackHciFabricArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ARM Id of the target AzStackHCI fabric. Required.""" + az_stack_hci_site_id: Optional[str] = rest_field(name="azStackHciSiteId", visibility=["read"]) + """Gets or sets the ARM Id of the AzStackHCI site.""" + storage_account_id: Optional[str] = rest_field( + name="storageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the storage account Id.""" + storage_account_sas_secret_name: Optional[str] = rest_field( + name="storageAccountSasSecretName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Sas Secret of storage account.""" + asr_service_uri: Optional[str] = rest_field(name="asrServiceUri", visibility=["read"]) + """Gets or sets the Uri of ASR.""" + rcm_service_uri: Optional[str] = rest_field(name="rcmServiceUri", visibility=["read"]) + """Gets or sets the Uri of Rcm.""" + gateway_service_uri: Optional[str] = rest_field(name="gatewayServiceUri", visibility=["read"]) + """Gets or sets the Uri of Gateway.""" + source_gateway_service_id: Optional[str] = rest_field(name="sourceGatewayServiceId", visibility=["read"]) + """Gets or sets the gateway service Id of source.""" + target_gateway_service_id: Optional[str] = rest_field(name="targetGatewayServiceId", visibility=["read"]) + """Gets or sets the gateway service Id of target.""" + source_storage_container_name: Optional[str] = rest_field(name="sourceStorageContainerName", visibility=["read"]) + """Gets or sets the source storage container name.""" + target_storage_container_name: Optional[str] = rest_field(name="targetStorageContainerName", visibility=["read"]) + """Gets or sets the target storage container name.""" + resource_location: Optional[str] = rest_field(name="resourceLocation", visibility=["read"]) + """Gets or sets the resource location.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId", visibility=["read"]) + """Gets or sets the subscription.""" + resource_group: Optional[str] = rest_field(name="resourceGroup", visibility=["read"]) + """Gets or sets the resource group.""" + instance_type: Literal["HyperVToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"HyperVToAzStackHCI\".""" + + @overload + def __init__( + self, + *, + hyper_v_fabric_arm_id: str, + az_stack_hci_fabric_arm_id: str, + storage_account_id: Optional[str] = None, + storage_account_sas_secret_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, instance_type="HyperVToAzStackHCI", **kwargs) + + +class IdentityModel(_Model): + """Identity model. + + :ivar tenant_id: Gets or sets the tenant Id of the SPN with which fabric agent communicates to + service. Required. + :vartype tenant_id: str + :ivar application_id: Gets or sets the client/application Id of the SPN with which fabric agent + communicates to service. Required. + :vartype application_id: str + :ivar object_id: Gets or sets the object Id of the SPN with which fabric agent communicates to + service. Required. + :vartype object_id: str + :ivar audience: Gets or sets the audience of the SPN with which fabric agent communicates to + service. Required. + :vartype audience: str + :ivar aad_authority: Gets or sets the authority of the SPN with which fabric agent communicates + to service. Required. + :vartype aad_authority: str + """ + + tenant_id: str = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tenant Id of the SPN with which fabric agent communicates to service. + Required.""" + application_id: str = rest_field(name="applicationId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the client/application Id of the SPN with which fabric agent communicates to + service. Required.""" + object_id: str = rest_field(name="objectId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the object Id of the SPN with which fabric agent communicates to service. + Required.""" + audience: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the audience of the SPN with which fabric agent communicates to service. Required.""" + aad_authority: str = rest_field(name="aadAuthority", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the authority of the SPN with which fabric agent communicates to service. + Required.""" + + @overload + def __init__( + self, + *, + tenant_id: str, + application_id: str, + object_id: str, + audience: str, + aad_authority: 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 InnerHealthErrorModel(_Model): + """Inner health error model. + + :ivar code: Gets or sets the error code. + :vartype code: str + :ivar health_category: Gets or sets the health category. + :vartype health_category: str + :ivar category: Gets or sets the error category. + :vartype category: str + :ivar severity: Gets or sets the error severity. + :vartype severity: str + :ivar source: Gets or sets the error source. + :vartype source: str + :ivar creation_time: Gets or sets the error creation time. + :vartype creation_time: ~datetime.datetime + :ivar is_customer_resolvable: Gets or sets a value indicating whether the error is customer + resolvable. + :vartype is_customer_resolvable: bool + :ivar summary: Gets or sets the error summary. + :vartype summary: str + :ivar message: Gets or sets the error message. + :vartype message: str + :ivar causes: Gets or sets possible causes of the error. + :vartype causes: str + :ivar recommendation: Gets or sets recommended action to resolve the error. + :vartype recommendation: str + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error code.""" + health_category: Optional[str] = rest_field(name="healthCategory", visibility=["read"]) + """Gets or sets the health category.""" + category: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error category.""" + severity: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error severity.""" + source: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error source.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Gets or sets the error creation time.""" + is_customer_resolvable: Optional[bool] = rest_field(name="isCustomerResolvable", visibility=["read"]) + """Gets or sets a value indicating whether the error is customer resolvable.""" + summary: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error summary.""" + message: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the error message.""" + causes: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets possible causes of the error.""" + recommendation: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets recommended action to resolve the error.""" + + +class JobModel(ProxyResource): + """Job 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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.JobModelProperties + """ + + properties: Optional["_models.JobModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.JobModelProperties"] = 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 JobModelCustomPropertiesAffectedObjectDetails(_Model): # pylint: disable=name-too-long + """JobModelCustomPropertiesAffectedObjectDetails. + + :ivar description: + :vartype description: str + :ivar type: Default value is "object". + :vartype type: str + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + type: Optional[Literal["object"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Default value is \"object\".""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + type: Optional[Literal["object"]] = 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 JobModelProperties(_Model): + """Job model properties. + + :ivar display_name: Gets or sets the friendly display name. + :vartype display_name: str + :ivar state: Gets or sets the job state. Known values are: "Pending", "Started", "Cancelling", + "Succeeded", "Failed", "Cancelled", "CompletedWithInformation", "CompletedWithWarnings", and + "CompletedWithErrors". + :vartype state: str or ~azure.mgmt.recoveryservicesdatareplication.models.JobState + :ivar start_time: Gets or sets the start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Gets or sets the end time. + :vartype end_time: ~datetime.datetime + :ivar object_id: Gets or sets the affected object Id. + :vartype object_id: str + :ivar object_name: Gets or sets the affected object name. + :vartype object_name: str + :ivar object_internal_id: Gets or sets the affected object internal Id. + :vartype object_internal_id: str + :ivar object_internal_name: Gets or sets the affected object internal name. + :vartype object_internal_name: str + :ivar object_type: Gets or sets the object type. Known values are: "AvsDiskPool", + "FabricAgent", "Fabric", "Policy", "ProtectedItem", "RecoveryPlan", "ReplicationExtension", and + "Vault". + :vartype object_type: str or ~azure.mgmt.recoveryservicesdatareplication.models.JobObjectType + :ivar replication_provider_id: Gets or sets the replication provider. + :vartype replication_provider_id: str + :ivar source_fabric_provider_id: Gets or sets the source fabric provider. + :vartype source_fabric_provider_id: str + :ivar target_fabric_provider_id: Gets or sets the target fabric provider. + :vartype target_fabric_provider_id: str + :ivar allowed_actions: Gets or sets the list of allowed actions on the job. + :vartype allowed_actions: list[str] + :ivar activity_id: Gets or sets the job activity id. + :vartype activity_id: str + :ivar tasks: Gets or sets the list of tasks. + :vartype tasks: list[~azure.mgmt.recoveryservicesdatareplication.models.TaskModel] + :ivar errors: Gets or sets the list of errors. + :vartype errors: list[~azure.mgmt.recoveryservicesdatareplication.models.ErrorModel] + :ivar custom_properties: Job model custom properties. Required. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.JobModelCustomProperties + :ivar provisioning_state: Gets or sets the provisioning state of the job. Known values are: + "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + """ + + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """Gets or sets the friendly display name.""" + state: Optional[Union[str, "_models.JobState"]] = rest_field(visibility=["read"]) + """Gets or sets the job state. Known values are: \"Pending\", \"Started\", \"Cancelling\", + \"Succeeded\", \"Failed\", \"Cancelled\", \"CompletedWithInformation\", + \"CompletedWithWarnings\", and \"CompletedWithErrors\".""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Gets or sets the start time.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """Gets or sets the end time.""" + object_id: Optional[str] = rest_field(name="objectId", visibility=["read"]) + """Gets or sets the affected object Id.""" + object_name: Optional[str] = rest_field(name="objectName", visibility=["read"]) + """Gets or sets the affected object name.""" + object_internal_id: Optional[str] = rest_field(name="objectInternalId", visibility=["read"]) + """Gets or sets the affected object internal Id.""" + object_internal_name: Optional[str] = rest_field(name="objectInternalName", visibility=["read"]) + """Gets or sets the affected object internal name.""" + object_type: Optional[Union[str, "_models.JobObjectType"]] = rest_field(name="objectType", visibility=["read"]) + """Gets or sets the object type. Known values are: \"AvsDiskPool\", \"FabricAgent\", \"Fabric\", + \"Policy\", \"ProtectedItem\", \"RecoveryPlan\", \"ReplicationExtension\", and \"Vault\".""" + replication_provider_id: Optional[str] = rest_field(name="replicationProviderId", visibility=["read"]) + """Gets or sets the replication provider.""" + source_fabric_provider_id: Optional[str] = rest_field(name="sourceFabricProviderId", visibility=["read"]) + """Gets or sets the source fabric provider.""" + target_fabric_provider_id: Optional[str] = rest_field(name="targetFabricProviderId", visibility=["read"]) + """Gets or sets the target fabric provider.""" + allowed_actions: Optional[List[str]] = rest_field(name="allowedActions", visibility=["read"]) + """Gets or sets the list of allowed actions on the job.""" + activity_id: Optional[str] = rest_field(name="activityId", visibility=["read"]) + """Gets or sets the job activity id.""" + tasks: Optional[List["_models.TaskModel"]] = rest_field(visibility=["read"]) + """Gets or sets the list of tasks.""" + errors: Optional[List["_models.ErrorModel"]] = rest_field(visibility=["read"]) + """Gets or sets the list of errors.""" + custom_properties: "_models.JobModelCustomProperties" = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Job model custom properties. Required.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the job. Known values are: \"Canceled\", \"Creating\", + \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and \"Updating\".""" + + @overload + def __init__( + self, + *, + custom_properties: "_models.JobModelCustomProperties", + ) -> 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 ManagedServiceIdentity(_Model): + """Managed service identity (system assigned and/or user assigned identities). + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.recoveryservicesdatareplication.models.UserAssignedIdentity] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The service principal ID of the system assigned identity. This property will only be provided + for a system assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of the system assigned identity. This property will only be provided for a system + assigned identity.""" + type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of managed identity assigned to this resource. Required. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The identities assigned to this resource by the user.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = 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): + """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.recoveryservicesdatareplication.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.recoveryservicesdatareplication.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.recoveryservicesdatareplication.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): + """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 OperationStatus(_Model): + """Defines the operation status. + + :ivar id: Gets or sets the Id. + :vartype id: str + :ivar name: Gets or sets the operation name. + :vartype name: str + :ivar status: Gets or sets the status of the operation. ARM expects the terminal status to be + one of Succeeded/ Failed/ Canceled. All other values imply that the operation is still running. + :vartype status: str + :ivar start_time: Gets or sets the start time. + :vartype start_time: str + :ivar end_time: Gets or sets the end time. + :vartype end_time: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the Id.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the operation name.""" + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the status of the operation. ARM expects the terminal status to be one of + Succeeded/ Failed/ Canceled. All other values imply that the operation is still running.""" + start_time: Optional[str] = rest_field(name="startTime", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the start time.""" + end_time: Optional[str] = rest_field(name="endTime", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the end time.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + status: Optional[str] = None, + start_time: Optional[str] = None, + end_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 PlannedFailoverModel(_Model): + """Planned failover model. + + :ivar properties: Planned failover model properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModelProperties + """ + + properties: "_models.PlannedFailoverModelProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Planned failover model properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.PlannedFailoverModelProperties", + ) -> 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 PlannedFailoverModelProperties(_Model): + """Planned failover model properties. + + :ivar custom_properties: Planned failover model custom properties. Required. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModelCustomProperties + """ + + custom_properties: "_models.PlannedFailoverModelCustomProperties" = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Planned failover model custom properties. Required.""" + + @overload + def __init__( + self, + *, + custom_properties: "_models.PlannedFailoverModelCustomProperties", + ) -> 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 PolicyModel(ProxyResource): + """Policy 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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModelProperties + """ + + properties: Optional["_models.PolicyModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PolicyModelProperties"] = 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 PolicyModelProperties(_Model): + """Policy model properties. + + :ivar provisioning_state: Gets or sets the provisioning state of the policy. Known values are: + "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + :ivar custom_properties: Policy model custom properties. Required. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModelCustomProperties + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the policy. Known values are: \"Canceled\", + \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and \"Updating\".""" + custom_properties: "_models.PolicyModelCustomProperties" = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy model custom properties. Required.""" + + @overload + def __init__( + self, + *, + custom_properties: "_models.PolicyModelCustomProperties", + ) -> 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 PrivateEndpoint(_Model): + """Represent private Endpoint network resource that is linked to the Private Endpoint connection. + + :ivar id: Gets or sets the id. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the id.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # 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 PrivateEndpointConnection(ProxyResource): + """Represents private endpoint connection. + + :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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionResponseProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionResponseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionResponseProperties"] = 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 PrivateEndpointConnectionProxy(ProxyResource): + """Represents private endpoint connection proxy request. + + :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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxyProperties + :ivar etag: Gets or sets ETag. + :vartype etag: str + """ + + properties: Optional["_models.PrivateEndpointConnectionProxyProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets ETag.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProxyProperties"] = None, + etag: 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 PrivateEndpointConnectionProxyProperties(_Model): + """Represents private endpoint connection proxy request. + + :ivar provisioning_state: Gets or sets the provisioning state of the private endpoint + connection proxy. Known values are: "Canceled", "Creating", "Deleting", "Deleted", "Failed", + "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + :ivar remote_private_endpoint: Represent remote private endpoint information for the private + endpoint connection proxy. + :vartype remote_private_endpoint: + ~azure.mgmt.recoveryservicesdatareplication.models.RemotePrivateEndpoint + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the private endpoint connection proxy. Known values are: + \"Canceled\", \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and + \"Updating\".""" + remote_private_endpoint: Optional["_models.RemotePrivateEndpoint"] = rest_field( + name="remotePrivateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Represent remote private endpoint information for the private endpoint connection proxy.""" + + @overload + def __init__( + self, + *, + remote_private_endpoint: Optional["_models.RemotePrivateEndpoint"] = 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 PrivateEndpointConnectionResponseProperties(_Model): # pylint: disable=name-too-long + """Represents Private endpoint connection response properties. + + :ivar provisioning_state: Gets or sets provisioning state of the private endpoint connection. + Known values are: "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and + "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + :ivar private_endpoint: Represent private Endpoint network resource that is linked to the + Private Endpoint connection. + :vartype private_endpoint: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpoint + :ivar private_link_service_connection_state: Represents Private link service connection state. + :vartype private_link_service_connection_state: + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkServiceConnectionState + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets provisioning state of the private endpoint connection. Known values are: + \"Canceled\", \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and + \"Updating\".""" + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Represent private Endpoint network resource that is linked to the Private Endpoint connection.""" + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents Private link service connection state.""" + + @overload + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = 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 PrivateLinkResource(ProxyResource): + """Represents private link 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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = 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 PrivateLinkResourceProperties(_Model): + """Represents private link resource properties. + + :ivar group_id: Gets or sets the group id. + :vartype group_id: str + :ivar required_members: Gets or sets the required member. This translates to how many Private + IPs should be created for each privately linkable resource. + :vartype required_members: list[str] + :ivar required_zone_names: Gets or sets the private DNS zone names. + :vartype required_zone_names: list[str] + :ivar provisioning_state: Gets or sets the provisioning state of the private link resource. + Known values are: "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and + "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the group id.""" + required_members: Optional[List[str]] = rest_field( + name="requiredMembers", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the required member. This translates to how many Private IPs should be created for + each privately linkable resource.""" + required_zone_names: Optional[List[str]] = rest_field( + name="requiredZoneNames", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the private DNS zone names.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the private link resource. Known values are: + \"Canceled\", \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and + \"Updating\".""" + + @overload + def __init__( + self, + *, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: 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 PrivateLinkServiceConnection(_Model): + """Represents of an NRP private link service connection. + + :ivar name: Gets or sets private link service connection name. + :vartype name: str + :ivar group_ids: Gets or sets group ids. + :vartype group_ids: list[str] + :ivar request_message: Gets or sets the request message for the private link service + connection. + :vartype request_message: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets private link service connection name.""" + group_ids: Optional[List[str]] = rest_field( + name="groupIds", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets group ids.""" + request_message: Optional[str] = rest_field( + name="requestMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the request message for the private link service connection.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + group_ids: Optional[List[str]] = None, + request_message: 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 PrivateLinkServiceConnectionState(_Model): + """Represents Private link service connection state. + + :ivar status: Gets or sets the status. Known values are: "Approved", "Disconnected", "Pending", + and "Rejected". + :vartype status: str or + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionStatus + :ivar description: Gets or sets description. + :vartype description: str + :ivar actions_required: Gets or sets actions required. + :vartype actions_required: str + """ + + status: Optional[Union[str, "_models.PrivateEndpointConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the status. Known values are: \"Approved\", \"Disconnected\", \"Pending\", and + \"Rejected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets description.""" + actions_required: Optional[str] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets actions required.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: 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 PrivateLinkServiceProxy(_Model): + """Represents NRP private link service proxy. + + :ivar id: Gets or sets private link service proxy id. + :vartype id: str + :ivar remote_private_link_service_connection_state: Represents Private link service connection + state. + :vartype remote_private_link_service_connection_state: + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkServiceConnectionState + :ivar remote_private_endpoint_connection: Represent remote private endpoint connection. + :vartype remote_private_endpoint_connection: + ~azure.mgmt.recoveryservicesdatareplication.models.RemotePrivateEndpointConnection + :ivar group_connectivity_information: Gets or sets group connectivity information. + :vartype group_connectivity_information: + list[~azure.mgmt.recoveryservicesdatareplication.models.GroupConnectivityInformation] + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets private link service proxy id.""" + remote_private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = rest_field( + name="remotePrivateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents Private link service connection state.""" + remote_private_endpoint_connection: Optional["_models.RemotePrivateEndpointConnection"] = rest_field( + name="remotePrivateEndpointConnection", visibility=["read", "create", "update", "delete", "query"] + ) + """Represent remote private endpoint connection.""" + group_connectivity_information: Optional[List["_models.GroupConnectivityInformation"]] = rest_field( + name="groupConnectivityInformation", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets group connectivity information.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + remote_private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + remote_private_endpoint_connection: Optional["_models.RemotePrivateEndpointConnection"] = None, + group_connectivity_information: Optional[List["_models.GroupConnectivityInformation"]] = 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 ProtectedItemDynamicMemoryConfig(_Model): + """Protected item dynamic memory config. + + :ivar maximum_memory_in_mega_bytes: Gets or sets maximum memory in MB. Required. + :vartype maximum_memory_in_mega_bytes: int + :ivar minimum_memory_in_mega_bytes: Gets or sets minimum memory in MB. Required. + :vartype minimum_memory_in_mega_bytes: int + :ivar target_memory_buffer_percentage: Gets or sets target memory buffer in %. Required. + :vartype target_memory_buffer_percentage: int + """ + + maximum_memory_in_mega_bytes: int = rest_field( + name="maximumMemoryInMegaBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets maximum memory in MB. Required.""" + minimum_memory_in_mega_bytes: int = rest_field( + name="minimumMemoryInMegaBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets minimum memory in MB. Required.""" + target_memory_buffer_percentage: int = rest_field( + name="targetMemoryBufferPercentage", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets target memory buffer in %. Required.""" + + @overload + def __init__( + self, + *, + maximum_memory_in_mega_bytes: int, + minimum_memory_in_mega_bytes: int, + target_memory_buffer_percentage: 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 ProtectedItemJobProperties(_Model): + """Protected item job properties. + + :ivar scenario_name: Gets or sets protection scenario name. + :vartype scenario_name: str + :ivar id: Gets or sets job Id. + :vartype id: str + :ivar name: Gets or sets job name. + :vartype name: str + :ivar display_name: Gets or sets the job friendly display name. + :vartype display_name: str + :ivar state: Gets or sets job state. + :vartype state: str + :ivar start_time: Gets or sets start time of the job. + :vartype start_time: ~datetime.datetime + :ivar end_time: Gets or sets end time of the job. + :vartype end_time: ~datetime.datetime + """ + + scenario_name: Optional[str] = rest_field(name="scenarioName", visibility=["read"]) + """Gets or sets protection scenario name.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets job Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets job name.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """Gets or sets the job friendly display name.""" + state: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets job state.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Gets or sets start time of the job.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """Gets or sets end time of the job.""" + + +class ProtectedItemModel(ProxyResource): + """Protected item 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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelProperties + """ + + properties: Optional["_models.ProtectedItemModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ProtectedItemModelProperties"] = 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 ProtectedItemModelProperties(_Model): + """Protected item model properties. + + :ivar policy_name: Gets or sets the policy name. Required. + :vartype policy_name: str + :ivar replication_extension_name: Gets or sets the replication extension name. Required. + :vartype replication_extension_name: str + :ivar correlation_id: Gets or sets the protected item correlation Id. + :vartype correlation_id: str + :ivar provisioning_state: Gets or sets the provisioning state of the fabric agent. Known values + are: "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + :ivar protection_state: Gets or sets the protection state. Known values are: + "UnprotectedStatesBegin", "EnablingProtection", "EnablingFailed", "DisablingProtection", + "MarkedForDeletion", "DisablingFailed", "UnprotectedStatesEnd", + "InitialReplicationStatesBegin", "InitialReplicationInProgress", + "InitialReplicationCompletedOnPrimary", "InitialReplicationCompletedOnRecovery", + "InitialReplicationFailed", "InitialReplicationStatesEnd", "ProtectedStatesBegin", "Protected", + "ProtectedStatesEnd", "PlannedFailoverTransitionStatesBegin", "PlannedFailoverInitiated", + "PlannedFailoverCompleting", "PlannedFailoverCompleted", "PlannedFailoverFailed", + "PlannedFailoverCompletionFailed", "PlannedFailoverTransitionStatesEnd", + "UnplannedFailoverTransitionStatesBegin", "UnplannedFailoverInitiated", + "UnplannedFailoverCompleting", "UnplannedFailoverCompleted", "UnplannedFailoverFailed", + "UnplannedFailoverCompletionFailed", "UnplannedFailoverTransitionStatesEnd", + "CommitFailoverStatesBegin", "CommitFailoverInProgressOnPrimary", + "CommitFailoverInProgressOnRecovery", "CommitFailoverCompleted", + "CommitFailoverFailedOnPrimary", "CommitFailoverFailedOnRecovery", "CommitFailoverStatesEnd", + "CancelFailoverStatesBegin", "CancelFailoverInProgressOnPrimary", + "CancelFailoverInProgressOnRecovery", "CancelFailoverFailedOnPrimary", + "CancelFailoverFailedOnRecovery", "CancelFailoverStatesEnd", "ChangeRecoveryPointStatesBegin", + "ChangeRecoveryPointInitiated", "ChangeRecoveryPointCompleted", "ChangeRecoveryPointFailed", + "ChangeRecoveryPointStatesEnd", "ReprotectStatesBegin", "ReprotectInitiated", + "ReprotectFailed", and "ReprotectStatesEnd". + :vartype protection_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectionState + :ivar protection_state_description: Gets or sets the protection state description. + :vartype protection_state_description: str + :ivar test_failover_state: Gets or sets the test failover state. Known values are: "None", + "TestFailoverInitiated", "TestFailoverCompleting", "TestFailoverCompleted", + "TestFailoverFailed", "TestFailoverCompletionFailed", "TestFailoverCleanupInitiated", + "TestFailoverCleanupCompleting", and "MarkedForDeletion". + :vartype test_failover_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.TestFailoverState + :ivar test_failover_state_description: Gets or sets the Test failover state description. + :vartype test_failover_state_description: str + :ivar resynchronization_state: Gets or sets the resynchronization state. Known values are: + "None", "ResynchronizationInitiated", "ResynchronizationCompleted", and + "ResynchronizationFailed". + :vartype resynchronization_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ResynchronizationState + :ivar fabric_object_id: Gets or sets the fabric object Id. + :vartype fabric_object_id: str + :ivar fabric_object_name: Gets or sets the fabric object name. + :vartype fabric_object_name: str + :ivar source_fabric_provider_id: Gets or sets the source fabric provider Id. + :vartype source_fabric_provider_id: str + :ivar target_fabric_provider_id: Gets or sets the target fabric provider Id. + :vartype target_fabric_provider_id: str + :ivar fabric_id: Gets or sets the fabric Id. + :vartype fabric_id: str + :ivar target_fabric_id: Gets or sets the target fabric Id. + :vartype target_fabric_id: str + :ivar fabric_agent_id: Gets or sets the fabric agent Id. + :vartype fabric_agent_id: str + :ivar target_fabric_agent_id: Gets or sets the target fabric agent Id. + :vartype target_fabric_agent_id: str + :ivar resync_required: Gets or sets a value indicating whether resynchronization is required or + not. + :vartype resync_required: bool + :ivar last_successful_planned_failover_time: Gets or sets the Last successful planned failover + time. + :vartype last_successful_planned_failover_time: ~datetime.datetime + :ivar last_successful_unplanned_failover_time: Gets or sets the Last successful unplanned + failover time. + :vartype last_successful_unplanned_failover_time: ~datetime.datetime + :ivar last_successful_test_failover_time: Gets or sets the Last successful test failover time. + :vartype last_successful_test_failover_time: ~datetime.datetime + :ivar current_job: Gets or sets the current scenario. + :vartype current_job: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemJobProperties + :ivar allowed_jobs: Gets or sets the allowed scenarios on the protected item. + :vartype allowed_jobs: list[str] + :ivar last_failed_enable_protection_job: Gets or sets the last failed enabled protection job. + :vartype last_failed_enable_protection_job: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemJobProperties + :ivar last_failed_planned_failover_job: Gets or sets the last failed planned failover job. + :vartype last_failed_planned_failover_job: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemJobProperties + :ivar last_test_failover_job: Gets or sets the last test failover job. + :vartype last_test_failover_job: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemJobProperties + :ivar replication_health: Gets or sets protected item replication health. Known values are: + "Normal", "Warning", and "Critical". + :vartype replication_health: str or + ~azure.mgmt.recoveryservicesdatareplication.models.HealthStatus + :ivar health_errors: Gets or sets the list of health errors. + :vartype health_errors: + list[~azure.mgmt.recoveryservicesdatareplication.models.HealthErrorModel] + :ivar custom_properties: Protected item model custom properties. Required. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelCustomProperties + """ + + policy_name: str = rest_field(name="policyName", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the policy name. Required.""" + replication_extension_name: str = rest_field( + name="replicationExtensionName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the replication extension name. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId", visibility=["read"]) + """Gets or sets the protected item correlation Id.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the fabric agent. Known values are: \"Canceled\", + \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and \"Updating\".""" + protection_state: Optional[Union[str, "_models.ProtectionState"]] = rest_field( + name="protectionState", visibility=["read"] + ) + """Gets or sets the protection state. Known values are: \"UnprotectedStatesBegin\", + \"EnablingProtection\", \"EnablingFailed\", \"DisablingProtection\", \"MarkedForDeletion\", + \"DisablingFailed\", \"UnprotectedStatesEnd\", \"InitialReplicationStatesBegin\", + \"InitialReplicationInProgress\", \"InitialReplicationCompletedOnPrimary\", + \"InitialReplicationCompletedOnRecovery\", \"InitialReplicationFailed\", + \"InitialReplicationStatesEnd\", \"ProtectedStatesBegin\", \"Protected\", + \"ProtectedStatesEnd\", \"PlannedFailoverTransitionStatesBegin\", \"PlannedFailoverInitiated\", + \"PlannedFailoverCompleting\", \"PlannedFailoverCompleted\", \"PlannedFailoverFailed\", + \"PlannedFailoverCompletionFailed\", \"PlannedFailoverTransitionStatesEnd\", + \"UnplannedFailoverTransitionStatesBegin\", \"UnplannedFailoverInitiated\", + \"UnplannedFailoverCompleting\", \"UnplannedFailoverCompleted\", \"UnplannedFailoverFailed\", + \"UnplannedFailoverCompletionFailed\", \"UnplannedFailoverTransitionStatesEnd\", + \"CommitFailoverStatesBegin\", \"CommitFailoverInProgressOnPrimary\", + \"CommitFailoverInProgressOnRecovery\", \"CommitFailoverCompleted\", + \"CommitFailoverFailedOnPrimary\", \"CommitFailoverFailedOnRecovery\", + \"CommitFailoverStatesEnd\", \"CancelFailoverStatesBegin\", + \"CancelFailoverInProgressOnPrimary\", \"CancelFailoverInProgressOnRecovery\", + \"CancelFailoverFailedOnPrimary\", \"CancelFailoverFailedOnRecovery\", + \"CancelFailoverStatesEnd\", \"ChangeRecoveryPointStatesBegin\", + \"ChangeRecoveryPointInitiated\", \"ChangeRecoveryPointCompleted\", + \"ChangeRecoveryPointFailed\", \"ChangeRecoveryPointStatesEnd\", \"ReprotectStatesBegin\", + \"ReprotectInitiated\", \"ReprotectFailed\", and \"ReprotectStatesEnd\".""" + protection_state_description: Optional[str] = rest_field(name="protectionStateDescription", visibility=["read"]) + """Gets or sets the protection state description.""" + test_failover_state: Optional[Union[str, "_models.TestFailoverState"]] = rest_field( + name="testFailoverState", visibility=["read"] + ) + """Gets or sets the test failover state. Known values are: \"None\", \"TestFailoverInitiated\", + \"TestFailoverCompleting\", \"TestFailoverCompleted\", \"TestFailoverFailed\", + \"TestFailoverCompletionFailed\", \"TestFailoverCleanupInitiated\", + \"TestFailoverCleanupCompleting\", and \"MarkedForDeletion\".""" + test_failover_state_description: Optional[str] = rest_field( + name="testFailoverStateDescription", visibility=["read"] + ) + """Gets or sets the Test failover state description.""" + resynchronization_state: Optional[Union[str, "_models.ResynchronizationState"]] = rest_field( + name="resynchronizationState", visibility=["read"] + ) + """Gets or sets the resynchronization state. Known values are: \"None\", + \"ResynchronizationInitiated\", \"ResynchronizationCompleted\", and + \"ResynchronizationFailed\".""" + fabric_object_id: Optional[str] = rest_field(name="fabricObjectId", visibility=["read"]) + """Gets or sets the fabric object Id.""" + fabric_object_name: Optional[str] = rest_field(name="fabricObjectName", visibility=["read"]) + """Gets or sets the fabric object name.""" + source_fabric_provider_id: Optional[str] = rest_field(name="sourceFabricProviderId", visibility=["read"]) + """Gets or sets the source fabric provider Id.""" + target_fabric_provider_id: Optional[str] = rest_field(name="targetFabricProviderId", visibility=["read"]) + """Gets or sets the target fabric provider Id.""" + fabric_id: Optional[str] = rest_field(name="fabricId", visibility=["read"]) + """Gets or sets the fabric Id.""" + target_fabric_id: Optional[str] = rest_field(name="targetFabricId", visibility=["read"]) + """Gets or sets the target fabric Id.""" + fabric_agent_id: Optional[str] = rest_field(name="fabricAgentId", visibility=["read"]) + """Gets or sets the fabric agent Id.""" + target_fabric_agent_id: Optional[str] = rest_field(name="targetFabricAgentId", visibility=["read"]) + """Gets or sets the target fabric agent Id.""" + resync_required: Optional[bool] = rest_field(name="resyncRequired", visibility=["read"]) + """Gets or sets a value indicating whether resynchronization is required or not.""" + last_successful_planned_failover_time: Optional[datetime.datetime] = rest_field( + name="lastSuccessfulPlannedFailoverTime", visibility=["read"], format="rfc3339" + ) + """Gets or sets the Last successful planned failover time.""" + last_successful_unplanned_failover_time: Optional[datetime.datetime] = rest_field( + name="lastSuccessfulUnplannedFailoverTime", visibility=["read"], format="rfc3339" + ) + """Gets or sets the Last successful unplanned failover time.""" + last_successful_test_failover_time: Optional[datetime.datetime] = rest_field( + name="lastSuccessfulTestFailoverTime", visibility=["read"], format="rfc3339" + ) + """Gets or sets the Last successful test failover time.""" + current_job: Optional["_models.ProtectedItemJobProperties"] = rest_field(name="currentJob", visibility=["read"]) + """Gets or sets the current scenario.""" + allowed_jobs: Optional[List[str]] = rest_field(name="allowedJobs", visibility=["read"]) + """Gets or sets the allowed scenarios on the protected item.""" + last_failed_enable_protection_job: Optional["_models.ProtectedItemJobProperties"] = rest_field( + name="lastFailedEnableProtectionJob", visibility=["read"] + ) + """Gets or sets the last failed enabled protection job.""" + last_failed_planned_failover_job: Optional["_models.ProtectedItemJobProperties"] = rest_field( + name="lastFailedPlannedFailoverJob", visibility=["read"] + ) + """Gets or sets the last failed planned failover job.""" + last_test_failover_job: Optional["_models.ProtectedItemJobProperties"] = rest_field( + name="lastTestFailoverJob", visibility=["read"] + ) + """Gets or sets the last test failover job.""" + replication_health: Optional[Union[str, "_models.HealthStatus"]] = rest_field( + name="replicationHealth", visibility=["read"] + ) + """Gets or sets protected item replication health. Known values are: \"Normal\", \"Warning\", and + \"Critical\".""" + health_errors: Optional[List["_models.HealthErrorModel"]] = rest_field(name="healthErrors", visibility=["read"]) + """Gets or sets the list of health errors.""" + custom_properties: "_models.ProtectedItemModelCustomProperties" = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Protected item model custom properties. Required.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + policy_name: str, + replication_extension_name: str, + custom_properties: "_models.ProtectedItemModelCustomProperties", + ) -> 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 ProtectedItemModelPropertiesUpdate(_Model): + """Protected item model properties update. + + :ivar custom_properties: Protected item model custom properties update. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelCustomPropertiesUpdate + """ + + custom_properties: Optional["_models.ProtectedItemModelCustomPropertiesUpdate"] = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Protected item model custom properties update.""" + + @overload + def __init__( + self, + *, + custom_properties: Optional["_models.ProtectedItemModelCustomPropertiesUpdate"] = 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 ProtectedItemModelUpdate(_Model): + """Protected item model update. + + :ivar properties: Protected item model properties. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelPropertiesUpdate + :ivar id: Gets or sets the Id of the resource. + :vartype id: str + :ivar name: Gets or sets the name of the resource. + :vartype name: str + :ivar type: Gets or sets the type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.recoveryservicesdatareplication.models.SystemData + """ + + properties: Optional["_models.ProtectedItemModelPropertiesUpdate"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Protected item model properties.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the Id of the resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the type of the resource.""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Metadata pertaining to creation and last modification of the resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ProtectedItemModelPropertiesUpdate"] = 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 RecoveryPointModel(ProxyResource): + """Recovery point 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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModelProperties + """ + + properties: Optional["_models.RecoveryPointModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.RecoveryPointModelProperties"] = 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 RecoveryPointModelProperties(_Model): + """Recovery point model properties. + + :ivar recovery_point_time: Gets or sets the recovery point time. Required. + :vartype recovery_point_time: ~datetime.datetime + :ivar recovery_point_type: Gets or sets the recovery point type. Required. Known values are: + "ApplicationConsistent" and "CrashConsistent". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointType + :ivar custom_properties: Recovery point model custom properties. Required. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModelCustomProperties + :ivar provisioning_state: Gets or sets the provisioning state of the recovery point item. Known + values are: "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and + "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + """ + + recovery_point_time: datetime.datetime = rest_field( + name="recoveryPointTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the recovery point time. Required.""" + recovery_point_type: Union[str, "_models.RecoveryPointType"] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the recovery point type. Required. Known values are: \"ApplicationConsistent\" and + \"CrashConsistent\".""" + custom_properties: "_models.RecoveryPointModelCustomProperties" = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery point model custom properties. Required.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the recovery point item. Known values are: \"Canceled\", + \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and \"Updating\".""" + + @overload + def __init__( + self, + *, + recovery_point_time: datetime.datetime, + recovery_point_type: Union[str, "_models.RecoveryPointType"], + custom_properties: "_models.RecoveryPointModelCustomProperties", + ) -> 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 RemotePrivateEndpoint(_Model): + """Represent remote private endpoint information for the private endpoint connection proxy. + + :ivar id: Gets or sets private link service proxy id. Required. + :vartype id: str + :ivar private_link_service_connections: Gets or sets the list of Private Link Service + Connections and gets populated for Auto approval flow. + :vartype private_link_service_connections: + list[~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkServiceConnection] + :ivar manual_private_link_service_connections: Gets or sets the list of Manual Private Link + Service Connections and gets populated for Manual approval flow. + :vartype manual_private_link_service_connections: + list[~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkServiceConnection] + :ivar private_link_service_proxies: Gets or sets the list of private link service proxies. + :vartype private_link_service_proxies: + list[~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkServiceProxy] + :ivar connection_details: Gets or sets the list of Connection Details. This is the connection + details for private endpoint. + :vartype connection_details: + list[~azure.mgmt.recoveryservicesdatareplication.models.ConnectionDetails] + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets private link service proxy id. Required.""" + private_link_service_connections: Optional[List["_models.PrivateLinkServiceConnection"]] = rest_field( + name="privateLinkServiceConnections", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of Private Link Service Connections and gets populated for Auto approval + flow.""" + manual_private_link_service_connections: Optional[List["_models.PrivateLinkServiceConnection"]] = rest_field( + name="manualPrivateLinkServiceConnections", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of Manual Private Link Service Connections and gets populated for Manual + approval flow.""" + private_link_service_proxies: Optional[List["_models.PrivateLinkServiceProxy"]] = rest_field( + name="privateLinkServiceProxies", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of private link service proxies.""" + connection_details: Optional[List["_models.ConnectionDetails"]] = rest_field( + name="connectionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of Connection Details. This is the connection details for private + endpoint.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + private_link_service_connections: Optional[List["_models.PrivateLinkServiceConnection"]] = None, + manual_private_link_service_connections: Optional[List["_models.PrivateLinkServiceConnection"]] = None, + private_link_service_proxies: Optional[List["_models.PrivateLinkServiceProxy"]] = None, + connection_details: Optional[List["_models.ConnectionDetails"]] = 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 RemotePrivateEndpointConnection(_Model): + """Represent remote private endpoint connection. + + :ivar id: Gets or sets the remote private endpoint connection id. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the remote private endpoint connection id.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # 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 ReplicationExtensionModel(ProxyResource): + """Replication extension 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.recoveryservicesdatareplication.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModelProperties + """ + + properties: Optional["_models.ReplicationExtensionModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ReplicationExtensionModelProperties"] = 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 ReplicationExtensionModelProperties(_Model): + """Replication extension model properties. + + :ivar provisioning_state: Gets or sets the provisioning state of the replication extension. + Known values are: "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and + "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + :ivar custom_properties: Replication extension model custom properties. Required. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModelCustomProperties + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the replication extension. Known values are: + \"Canceled\", \"Creating\", \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and + \"Updating\".""" + custom_properties: "_models.ReplicationExtensionModelCustomProperties" = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Replication extension model custom properties. Required.""" + + @overload + def __init__( + self, + *, + custom_properties: "_models.ReplicationExtensionModelCustomProperties", + ) -> 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 StorageContainerProperties(_Model): + """Storage container properties. + + :ivar name: Gets or sets the Name. Required. + :vartype name: str + :ivar cluster_shared_volume_path: Gets or sets the ClusterSharedVolumePath. Required. + :vartype cluster_shared_volume_path: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the Name. Required.""" + cluster_shared_volume_path: str = rest_field( + name="clusterSharedVolumePath", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ClusterSharedVolumePath. Required.""" + + @overload + def __init__( + self, + *, + name: str, + cluster_shared_volume_path: 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 SystemData(_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.recoveryservicesdatareplication.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.recoveryservicesdatareplication.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 TaskModel(_Model): + """Task model. + + :ivar task_name: Gets or sets the task name. + :vartype task_name: str + :ivar state: Gets or sets the task state. Known values are: "Pending", "Started", "Succeeded", + "Failed", "Cancelled", and "Skipped". + :vartype state: str or ~azure.mgmt.recoveryservicesdatareplication.models.TaskState + :ivar start_time: Gets or sets the start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Gets or sets the end time. + :vartype end_time: ~datetime.datetime + :ivar custom_properties: Task model custom properties. + :vartype custom_properties: + ~azure.mgmt.recoveryservicesdatareplication.models.TaskModelCustomProperties + :ivar children_jobs: Gets or sets the list of children job models. + :vartype children_jobs: list[~azure.mgmt.recoveryservicesdatareplication.models.JobModel] + """ + + task_name: Optional[str] = rest_field(name="taskName", visibility=["read"]) + """Gets or sets the task name.""" + state: Optional[Union[str, "_models.TaskState"]] = rest_field(visibility=["read"]) + """Gets or sets the task state. Known values are: \"Pending\", \"Started\", \"Succeeded\", + \"Failed\", \"Cancelled\", and \"Skipped\".""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Gets or sets the start time.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """Gets or sets the end time.""" + custom_properties: Optional["_models.TaskModelCustomProperties"] = rest_field( + name="customProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Task model custom properties.""" + children_jobs: Optional[List["_models.JobModel"]] = rest_field( + name="childrenJobs", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of children job models.""" + + @overload + def __init__( + self, + *, + custom_properties: Optional["_models.TaskModelCustomProperties"] = None, + children_jobs: Optional[List["_models.JobModel"]] = 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 TaskModelCustomProperties(_Model): + """Task model custom properties. + + :ivar instance_type: Gets or sets the instance type. Required. + :vartype instance_type: str + """ + + instance_type: str = rest_field(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the instance type. Required.""" + + @overload + def __init__( + self, + *, + instance_type: 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 TestFailoverCleanupJobModelCustomProperties( + JobModelCustomProperties, discriminator="TestFailoverCleanupJobDetails" +): # pylint: disable=name-too-long + """Test failover cleanup job model custom properties. + + :ivar affected_object_details: Gets or sets any custom properties of the affected object. + :vartype affected_object_details: + ~azure.mgmt.recoveryservicesdatareplication.models.JobModelCustomPropertiesAffectedObjectDetails + :ivar comments: Gets or sets the test failover cleanup comments. + :vartype comments: str + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "TestFailoverCleanupJobDetails". + :vartype instance_type: str + """ + + comments: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the test failover cleanup comments.""" + instance_type: Literal["TestFailoverCleanupJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"TestFailoverCleanupJobDetails\".""" + + @overload + def __init__( + self, + ) -> 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, instance_type="TestFailoverCleanupJobDetails", **kwargs) + + +class TestFailoverJobModelCustomProperties(JobModelCustomProperties, discriminator="TestFailoverJobDetails"): + """Test failover job model custom properties. + + :ivar affected_object_details: Gets or sets any custom properties of the affected object. + :vartype affected_object_details: + ~azure.mgmt.recoveryservicesdatareplication.models.JobModelCustomPropertiesAffectedObjectDetails + :ivar protected_item_details: Gets or sets the test VM details. + :vartype protected_item_details: + list[~azure.mgmt.recoveryservicesdatareplication.models.FailoverProtectedItemProperties] + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "TestFailoverJobDetails". + :vartype instance_type: str + """ + + protected_item_details: Optional[List["_models.FailoverProtectedItemProperties"]] = rest_field( + name="protectedItemDetails", visibility=["read"] + ) + """Gets or sets the test VM details.""" + instance_type: Literal["TestFailoverJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"TestFailoverJobDetails\".""" + + @overload + def __init__( + self, + ) -> 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, instance_type="TestFailoverJobDetails", **kwargs) + + +class UserAssignedIdentity(_Model): + """User assigned identity properties. + + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + """ + + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + + +class VaultIdentityModel(_Model): + """Vault model. + + :ivar type: Gets or sets the identityType which can be either SystemAssigned or None. Required. + Known values are: "None", "SystemAssigned", and "UserAssigned". + :vartype type: str or ~azure.mgmt.recoveryservicesdatareplication.models.VaultIdentityType + :ivar principal_id: Gets or sets the object ID of the service principal object for the managed + identity that is used to grant role-based access to an Azure resource. + :vartype principal_id: str + :ivar tenant_id: Gets or sets a Globally Unique Identifier (GUID) that represents the Azure AD + tenant where the resource is now a member. + :vartype tenant_id: str + """ + + type: Union[str, "_models.VaultIdentityType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the identityType which can be either SystemAssigned or None. Required. Known + values are: \"None\", \"SystemAssigned\", and \"UserAssigned\".""" + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """Gets or sets the object ID of the service principal object for the managed identity that is + used to grant role-based access to an Azure resource.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """Gets or sets a Globally Unique Identifier (GUID) that represents the Azure AD tenant where the + resource is now a member.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.VaultIdentityType"], + ) -> 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 VaultModel(TrackedResource): + """Vault 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.recoveryservicesdatareplication.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.recoveryservicesdatareplication.models.VaultModelProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.recoveryservicesdatareplication.models.ManagedServiceIdentity + """ + + properties: Optional["_models.VaultModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.VaultModelProperties"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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 VaultModelProperties(_Model): + """Vault properties. + + :ivar provisioning_state: Gets or sets the provisioning state of the vault. Known values are: + "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState + :ivar service_resource_id: Gets or sets the service resource Id. + :vartype service_resource_id: str + :ivar vault_type: Gets or sets the type of vault. Known values are: "DisasterRecovery" and + "Migrate". + :vartype vault_type: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationVaultType + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the vault. Known values are: \"Canceled\", \"Creating\", + \"Deleting\", \"Deleted\", \"Failed\", \"Succeeded\", and \"Updating\".""" + service_resource_id: Optional[str] = rest_field(name="serviceResourceId", visibility=["read"]) + """Gets or sets the service resource Id.""" + vault_type: Optional[Union[str, "_models.ReplicationVaultType"]] = rest_field( + name="vaultType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of vault. Known values are: \"DisasterRecovery\" and \"Migrate\".""" + + @overload + def __init__( + self, + *, + vault_type: Optional[Union[str, "_models.ReplicationVaultType"]] = 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 VaultModelUpdate(_Model): + """Vault model update. + + :ivar tags: Gets or sets the resource tags. + :vartype tags: dict[str, str] + :ivar properties: Vault properties. + :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelProperties + :ivar identity: Vault identity. + :vartype identity: ~azure.mgmt.recoveryservicesdatareplication.models.VaultIdentityModel + :ivar id: Gets or sets the Id of the resource. + :vartype id: str + :ivar name: Gets or sets the name of the resource. + :vartype name: str + :ivar type: Gets or sets the type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.recoveryservicesdatareplication.models.SystemData + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the resource tags.""" + properties: Optional["_models.VaultModelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Vault properties.""" + identity: Optional["_models.VaultIdentityModel"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Vault identity.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the Id of the resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the type of the resource.""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Metadata pertaining to creation and last modification of the resource.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.VaultModelProperties"] = None, + identity: Optional["_models.VaultIdentityModel"] = 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 VMwareFabricAgentModelCustomProperties(FabricAgentModelCustomProperties, discriminator="VMware"): + """VMware fabric agent model custom properties. + + :ivar bios_id: Gets or sets the BIOS Id of the fabric agent machine. Required. + :vartype bios_id: str + :ivar mars_authentication_identity: Identity model. Required. + :vartype mars_authentication_identity: + ~azure.mgmt.recoveryservicesdatareplication.models.IdentityModel + :ivar instance_type: Gets or sets the instance type. Required. Default value is "VMware". + :vartype instance_type: str + """ + + bios_id: str = rest_field(name="biosId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the BIOS Id of the fabric agent machine. Required.""" + mars_authentication_identity: "_models.IdentityModel" = rest_field( + name="marsAuthenticationIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """Identity model. Required.""" + instance_type: Literal["VMware"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"VMware\".""" + + @overload + def __init__( + self, + *, + bios_id: str, + mars_authentication_identity: "_models.IdentityModel", + ) -> 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, instance_type="VMware", **kwargs) + + +class VMwareMigrateFabricModelCustomProperties(FabricModelCustomProperties, discriminator="VMwareMigrate"): + """VMware migrate fabric model custom properties. + + :ivar vmware_site_id: Gets or sets the ARM Id of the VMware site. Required. + :vartype vmware_site_id: str + :ivar migration_solution_id: Gets or sets the ARM Id of the migration solution. Required. + :vartype migration_solution_id: str + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "VMwareMigrate". + :vartype instance_type: str + """ + + vmware_site_id: str = rest_field(name="vmwareSiteId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the ARM Id of the VMware site. Required.""" + migration_solution_id: str = rest_field( + name="migrationSolutionId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ARM Id of the migration solution. Required.""" + instance_type: Literal["VMwareMigrate"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"VMwareMigrate\".""" + + @overload + def __init__( + self, + *, + vmware_site_id: str, + migration_solution_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, instance_type="VMwareMigrate", **kwargs) + + +class VMwareToAzStackHCIDiskInput(_Model): + """VMwareToAzStack disk input. + + :ivar disk_id: Gets or sets the disk Id. Required. + :vartype disk_id: str + :ivar storage_container_id: Gets or sets the target storage account ARM Id. + :vartype storage_container_id: str + :ivar is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the + virtual hard disk. + :vartype is_dynamic: bool + :ivar disk_size_gb: Gets or sets the disk size in GB. Required. + :vartype disk_size_gb: int + :ivar disk_file_format: Gets or sets the type of the virtual hard disk, vhd or vhdx. Required. + :vartype disk_file_format: str + :ivar is_os_disk: Gets or sets a value indicating whether disk is os disk. Required. + :vartype is_os_disk: bool + :ivar disk_block_size: Gets or sets a value of disk block size. + :vartype disk_block_size: int + :ivar disk_logical_sector_size: Gets or sets a value of disk logical sector size. + :vartype disk_logical_sector_size: int + :ivar disk_physical_sector_size: Gets or sets a value of disk physical sector size. + :vartype disk_physical_sector_size: int + :ivar disk_identifier: Gets or sets a value of disk identifier. + :vartype disk_identifier: str + :ivar disk_controller: Disk controller. + :vartype disk_controller: + ~azure.mgmt.recoveryservicesdatareplication.models.DiskControllerInputs + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the disk Id. Required.""" + storage_container_id: Optional[str] = rest_field( + name="storageContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target storage account ARM Id.""" + is_dynamic: Optional[bool] = rest_field( + name="isDynamic", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk.""" + disk_size_gb: int = rest_field(name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the disk size in GB. Required.""" + disk_file_format: str = rest_field( + name="diskFileFormat", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of the virtual hard disk, vhd or vhdx. Required.""" + is_os_disk: bool = rest_field(name="isOsDisk", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets a value indicating whether disk is os disk. Required.""" + disk_block_size: Optional[int] = rest_field( + name="diskBlockSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value of disk block size.""" + disk_logical_sector_size: Optional[int] = rest_field( + name="diskLogicalSectorSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value of disk logical sector size.""" + disk_physical_sector_size: Optional[int] = rest_field( + name="diskPhysicalSectorSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value of disk physical sector size.""" + disk_identifier: Optional[str] = rest_field( + name="diskIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value of disk identifier.""" + disk_controller: Optional["_models.DiskControllerInputs"] = rest_field( + name="diskController", visibility=["read", "create", "update", "delete", "query"] + ) + """Disk controller.""" + + @overload + def __init__( + self, + *, + disk_id: str, + disk_size_gb: int, + disk_file_format: str, + is_os_disk: bool, + storage_container_id: Optional[str] = None, + is_dynamic: Optional[bool] = None, + disk_block_size: Optional[int] = None, + disk_logical_sector_size: Optional[int] = None, + disk_physical_sector_size: Optional[int] = None, + disk_identifier: Optional[str] = None, + disk_controller: Optional["_models.DiskControllerInputs"] = 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 VMwareToAzStackHCIEventModelCustomProperties( + EventModelCustomProperties, discriminator="VMwareToAzStackHCI" +): # pylint: disable=name-too-long + """VMware to AzStackHCI event model custom properties. This class provides provider specific + details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and + DataContract.HealthEvents.HealthEventType.AgentHealth. + + :ivar event_source_friendly_name: Gets or sets the friendly name of the source which has raised + this health event. + :vartype event_source_friendly_name: str + :ivar protected_item_friendly_name: Gets or sets the protected item friendly name. + :vartype protected_item_friendly_name: str + :ivar source_appliance_name: Gets or sets the source appliance name. + :vartype source_appliance_name: str + :ivar target_appliance_name: Gets or sets the source target name. + :vartype target_appliance_name: str + :ivar server_type: Gets or sets the server type. + :vartype server_type: str + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "VMwareToAzStackHCI". + :vartype instance_type: str + """ + + event_source_friendly_name: Optional[str] = rest_field(name="eventSourceFriendlyName", visibility=["read"]) + """Gets or sets the friendly name of the source which has raised this health event.""" + protected_item_friendly_name: Optional[str] = rest_field(name="protectedItemFriendlyName", visibility=["read"]) + """Gets or sets the protected item friendly name.""" + source_appliance_name: Optional[str] = rest_field(name="sourceApplianceName", visibility=["read"]) + """Gets or sets the source appliance name.""" + target_appliance_name: Optional[str] = rest_field(name="targetApplianceName", visibility=["read"]) + """Gets or sets the source target name.""" + server_type: Optional[str] = rest_field(name="serverType", visibility=["read"]) + """Gets or sets the server type.""" + instance_type: Literal["VMwareToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"VMwareToAzStackHCI\".""" + + @overload + def __init__( + self, + ) -> 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, instance_type="VMwareToAzStackHCI", **kwargs) + + +class VMwareToAzStackHCINicInput(_Model): + """VMwareToAzStackHCI NIC properties. + + :ivar nic_id: Gets or sets the NIC Id. Required. + :vartype nic_id: str + :ivar label: Gets or sets the NIC label. Required. + :vartype label: str + :ivar network_name: Gets or sets the network name. + :vartype network_name: str + :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. + :vartype target_network_id: str + :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. + :vartype test_network_id: str + :ivar selection_type_for_failover: Gets or sets the selection type of the NIC. Required. Known + values are: "NotSelected", "SelectedByUser", "SelectedByDefault", and "SelectedByUserOverride". + :vartype selection_type_for_failover: str or + ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection + :ivar is_static_ip_migration_enabled: Gets or sets a value indicating whether static ip + migration is enabled. + :vartype is_static_ip_migration_enabled: bool + :ivar is_mac_migration_enabled: Gets or sets a value indicating whether mac address migration + is enabled. + :vartype is_mac_migration_enabled: bool + """ + + nic_id: str = rest_field(name="nicId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the NIC Id. Required.""" + label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the NIC label. Required.""" + network_name: Optional[str] = rest_field(name="networkName", visibility=["read"]) + """Gets or sets the network name.""" + target_network_id: Optional[str] = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target network Id within AzStackHCI Cluster.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target test network Id within AzStackHCI Cluster.""" + selection_type_for_failover: Union[str, "_models.VMNicSelection"] = rest_field( + name="selectionTypeForFailover", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the selection type of the NIC. Required. Known values are: \"NotSelected\", + \"SelectedByUser\", \"SelectedByDefault\", and \"SelectedByUserOverride\".""" + is_static_ip_migration_enabled: Optional[bool] = rest_field( + name="isStaticIpMigrationEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether static ip migration is enabled.""" + is_mac_migration_enabled: Optional[bool] = rest_field( + name="isMacMigrationEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether mac address migration is enabled.""" + + @overload + def __init__( + self, + *, + nic_id: str, + label: str, + selection_type_for_failover: Union[str, "_models.VMNicSelection"], + target_network_id: Optional[str] = None, + test_network_id: Optional[str] = None, + is_static_ip_migration_enabled: Optional[bool] = None, + is_mac_migration_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 VMwareToAzStackHCIPlannedFailoverModelCustomProperties( + PlannedFailoverModelCustomProperties, discriminator="VMwareToAzStackHCI" +): # pylint: disable=name-too-long + """VMware to AzStackHCI planned failover model custom properties. + + :ivar shutdown_source_vm: Gets or sets a value indicating whether VM needs to be shut down. + Required. + :vartype shutdown_source_vm: bool + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "VMwareToAzStackHCI". + :vartype instance_type: str + """ + + shutdown_source_vm: bool = rest_field( + name="shutdownSourceVM", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether VM needs to be shut down. Required.""" + instance_type: Literal["VMwareToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"VMwareToAzStackHCI\".""" + + @overload + def __init__( + self, + *, + shutdown_source_vm: bool, + ) -> 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, instance_type="VMwareToAzStackHCI", **kwargs) + + +class VMwareToAzStackHCIPolicyModelCustomProperties( + PolicyModelCustomProperties, discriminator="VMwareToAzStackHCI" +): # pylint: disable=name-too-long + """VMware To AzStackHCI Policy model custom properties. + + :ivar recovery_point_history_in_minutes: Gets or sets the duration in minutes until which the + recovery points need to be stored. Required. + :vartype recovery_point_history_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: Gets or sets the crash consistent snapshot + frequency (in minutes). Required. + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: Gets or sets the app consistent snapshot frequency + (in minutes). Required. + :vartype app_consistent_frequency_in_minutes: int + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "VMwareToAzStackHCI". + :vartype instance_type: str + """ + + recovery_point_history_in_minutes: int = rest_field( + name="recoveryPointHistoryInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the duration in minutes until which the recovery points need to be stored. + Required.""" + crash_consistent_frequency_in_minutes: int = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the crash consistent snapshot frequency (in minutes). Required.""" + app_consistent_frequency_in_minutes: int = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the app consistent snapshot frequency (in minutes). Required.""" + instance_type: Literal["VMwareToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"VMwareToAzStackHCI\".""" + + @overload + def __init__( + self, + *, + recovery_point_history_in_minutes: int, + crash_consistent_frequency_in_minutes: int, + app_consistent_frequency_in_minutes: 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, instance_type="VMwareToAzStackHCI", **kwargs) + + +class VMwareToAzStackHCIProtectedDiskProperties(_Model): # pylint: disable=name-too-long + """VMwareToAzStackHCI protected disk properties. + + :ivar storage_container_id: Gets or sets the ARM Id of the storage container. + :vartype storage_container_id: str + :ivar storage_container_local_path: Gets or sets the local path of the storage container. + :vartype storage_container_local_path: str + :ivar source_disk_id: Gets or sets the source disk Id. + :vartype source_disk_id: str + :ivar source_disk_name: Gets or sets the source disk Name. + :vartype source_disk_name: str + :ivar seed_disk_name: Gets or sets the seed disk name. + :vartype seed_disk_name: str + :ivar test_migrate_disk_name: Gets or sets the test failover clone disk. + :vartype test_migrate_disk_name: str + :ivar migrate_disk_name: Gets or sets the failover clone disk. + :vartype migrate_disk_name: str + :ivar is_os_disk: Gets or sets a value indicating whether the disk is the OS disk. + :vartype is_os_disk: bool + :ivar capacity_in_bytes: Gets or sets the disk capacity in bytes. + :vartype capacity_in_bytes: int + :ivar is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the + virtual hard disk. + :vartype is_dynamic: bool + :ivar disk_type: Gets or sets the disk type. + :vartype disk_type: str + :ivar disk_block_size: Gets or sets a value of disk block size. + :vartype disk_block_size: int + :ivar disk_logical_sector_size: Gets or sets a value of disk logical sector size. + :vartype disk_logical_sector_size: int + :ivar disk_physical_sector_size: Gets or sets a value of disk physical sector size. + :vartype disk_physical_sector_size: int + """ + + storage_container_id: Optional[str] = rest_field(name="storageContainerId", visibility=["read"]) + """Gets or sets the ARM Id of the storage container.""" + storage_container_local_path: Optional[str] = rest_field(name="storageContainerLocalPath", visibility=["read"]) + """Gets or sets the local path of the storage container.""" + source_disk_id: Optional[str] = rest_field(name="sourceDiskId", visibility=["read"]) + """Gets or sets the source disk Id.""" + source_disk_name: Optional[str] = rest_field(name="sourceDiskName", visibility=["read"]) + """Gets or sets the source disk Name.""" + seed_disk_name: Optional[str] = rest_field(name="seedDiskName", visibility=["read"]) + """Gets or sets the seed disk name.""" + test_migrate_disk_name: Optional[str] = rest_field(name="testMigrateDiskName", visibility=["read"]) + """Gets or sets the test failover clone disk.""" + migrate_disk_name: Optional[str] = rest_field(name="migrateDiskName", visibility=["read"]) + """Gets or sets the failover clone disk.""" + is_os_disk: Optional[bool] = rest_field(name="isOsDisk", visibility=["read"]) + """Gets or sets a value indicating whether the disk is the OS disk.""" + capacity_in_bytes: Optional[int] = rest_field(name="capacityInBytes", visibility=["read"]) + """Gets or sets the disk capacity in bytes.""" + is_dynamic: Optional[bool] = rest_field(name="isDynamic", visibility=["read"]) + """Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk.""" + disk_type: Optional[str] = rest_field(name="diskType", visibility=["read"]) + """Gets or sets the disk type.""" + disk_block_size: Optional[int] = rest_field(name="diskBlockSize", visibility=["read"]) + """Gets or sets a value of disk block size.""" + disk_logical_sector_size: Optional[int] = rest_field(name="diskLogicalSectorSize", visibility=["read"]) + """Gets or sets a value of disk logical sector size.""" + disk_physical_sector_size: Optional[int] = rest_field(name="diskPhysicalSectorSize", visibility=["read"]) + """Gets or sets a value of disk physical sector size.""" + + +class VMwareToAzStackHCIProtectedItemModelCustomProperties( + ProtectedItemModelCustomProperties, discriminator="VMwareToAzStackHCI" +): # pylint: disable=name-too-long + """VMware to AzStackHCI Protected item model custom properties. + + :ivar active_location: Gets or sets the location of the protected item. Known values are: + "Primary" and "Recovery". + :vartype active_location: str or + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemActiveLocation + :ivar target_hci_cluster_id: Gets or sets the Target HCI Cluster ARM Id. Required. + :vartype target_hci_cluster_id: str + :ivar target_arc_cluster_custom_location_id: Gets or sets the Target Arc Cluster Custom + Location ARM Id. Required. + :vartype target_arc_cluster_custom_location_id: str + :ivar target_az_stack_hci_cluster_name: Gets or sets the Target AzStackHCI cluster name. + :vartype target_az_stack_hci_cluster_name: str + :ivar storage_container_id: Gets or sets the target storage container ARM Id. Required. + :vartype storage_container_id: str + :ivar target_resource_group_id: Gets or sets the target resource group ARM Id. Required. + :vartype target_resource_group_id: str + :ivar target_location: Gets or sets the target location. + :vartype target_location: str + :ivar custom_location_region: Gets or sets the location of Azure Arc HCI custom location + resource. Required. + :vartype custom_location_region: str + :ivar disks_to_include: Gets or sets the list of disks to replicate. Required. + :vartype disks_to_include: + list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIDiskInput] + :ivar nics_to_include: Gets or sets the list of VM NIC to replicate. Required. + :vartype nics_to_include: + list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCINicInput] + :ivar protected_disks: Gets or sets the list of protected disks. + :vartype protected_disks: + list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIProtectedDiskProperties] + :ivar protected_nics: Gets or sets the VM NIC details. + :vartype protected_nics: + list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIProtectedNicProperties] + :ivar target_vm_bios_id: Gets or sets the BIOS Id of the target AzStackHCI VM. + :vartype target_vm_bios_id: str + :ivar target_vm_name: Gets or sets the target VM display name. + :vartype target_vm_name: str + :ivar hyper_v_generation: Gets or sets the hypervisor generation of the virtual machine + possible values are 1,2. Required. + :vartype hyper_v_generation: str + :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. + :vartype target_network_id: str + :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. + :vartype test_network_id: str + :ivar target_cpu_cores: Gets or sets the target CPU cores. + :vartype target_cpu_cores: int + :ivar is_dynamic_ram: Gets or sets a value indicating whether memory is dynamical. + :vartype is_dynamic_ram: bool + :ivar dynamic_memory_config: Protected item dynamic memory config. + :vartype dynamic_memory_config: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemDynamicMemoryConfig + :ivar target_memory_in_mega_bytes: Gets or sets the target memory in mega-bytes. + :vartype target_memory_in_mega_bytes: int + :ivar os_type: Gets or sets the type of the OS. + :vartype os_type: str + :ivar os_name: Gets or sets the name of the OS. + :vartype os_name: str + :ivar firmware_type: Gets or sets the firmware type. + :vartype firmware_type: str + :ivar fabric_discovery_machine_id: Gets or sets the ARM Id of the discovered machine. Required. + :vartype fabric_discovery_machine_id: str + :ivar source_vm_name: Gets or sets the source VM display name. + :vartype source_vm_name: str + :ivar source_cpu_cores: Gets or sets the source VM CPU cores. + :vartype source_cpu_cores: int + :ivar source_memory_in_mega_bytes: Gets or sets the source VM ram memory size in megabytes. + :vartype source_memory_in_mega_bytes: float + :ivar run_as_account_id: Gets or sets the run as account Id. Required. + :vartype run_as_account_id: str + :ivar source_fabric_agent_name: Gets or sets the source fabric agent name. Required. + :vartype source_fabric_agent_name: str + :ivar target_fabric_agent_name: Gets or sets the target fabric agent name. Required. + :vartype target_fabric_agent_name: str + :ivar source_appliance_name: Gets or sets the source appliance name. + :vartype source_appliance_name: str + :ivar target_appliance_name: Gets or sets the target appliance name. + :vartype target_appliance_name: str + :ivar failover_recovery_point_id: Gets or sets the recovery point Id to which the VM was failed + over. + :vartype failover_recovery_point_id: str + :ivar last_recovery_point_received: Gets or sets the last recovery point received time. + :vartype last_recovery_point_received: ~datetime.datetime + :ivar last_recovery_point_id: Gets or sets the last recovery point Id. + :vartype last_recovery_point_id: str + :ivar initial_replication_progress_percentage: Gets or sets the initial replication progress + percentage. This is calculated based on total bytes processed for all disks in the source VM. + :vartype initial_replication_progress_percentage: int + :ivar migration_progress_percentage: Gets or sets the migration progress percentage. + :vartype migration_progress_percentage: int + :ivar resume_progress_percentage: Gets or sets the resume progress percentage. + :vartype resume_progress_percentage: int + :ivar resync_progress_percentage: Gets or sets the resync progress percentage. This is + calculated based on total bytes processed for all disks in the source VM. + :vartype resync_progress_percentage: int + :ivar resync_retry_count: Gets or sets the resync retry count. + :vartype resync_retry_count: int + :ivar resync_required: Gets or sets a value indicating whether resync is required. + :vartype resync_required: bool + :ivar resync_state: Gets or sets the resync state. Known values are: "None", + "PreparedForResynchronization", and "StartedResynchronization". + :vartype resync_state: str or + ~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzureMigrateResyncState + :ivar perform_auto_resync: Gets or sets a value indicating whether auto resync is to be done. + :vartype perform_auto_resync: bool + :ivar resume_retry_count: Gets or sets the resume retry count. + :vartype resume_retry_count: int + :ivar last_replication_update_time: Gets or sets the latest timestamp that replication status + is updated. + :vartype last_replication_update_time: ~datetime.datetime + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "VMwareToAzStackHCI". + :vartype instance_type: str + """ + + active_location: Optional[Union[str, "_models.ProtectedItemActiveLocation"]] = rest_field( + name="activeLocation", visibility=["read"] + ) + """Gets or sets the location of the protected item. Known values are: \"Primary\" and + \"Recovery\".""" + target_hci_cluster_id: str = rest_field( + name="targetHciClusterId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Target HCI Cluster ARM Id. Required.""" + target_arc_cluster_custom_location_id: str = rest_field( + name="targetArcClusterCustomLocationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Target Arc Cluster Custom Location ARM Id. Required.""" + target_az_stack_hci_cluster_name: Optional[str] = rest_field( + name="targetAzStackHciClusterName", visibility=["read"] + ) + """Gets or sets the Target AzStackHCI cluster name.""" + storage_container_id: str = rest_field( + name="storageContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target storage container ARM Id. Required.""" + target_resource_group_id: str = rest_field( + name="targetResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target resource group ARM Id. Required.""" + target_location: Optional[str] = rest_field(name="targetLocation", visibility=["read"]) + """Gets or sets the target location.""" + custom_location_region: str = rest_field( + name="customLocationRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the location of Azure Arc HCI custom location resource. Required.""" + disks_to_include: List["_models.VMwareToAzStackHCIDiskInput"] = rest_field( + name="disksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of disks to replicate. Required.""" + nics_to_include: List["_models.VMwareToAzStackHCINicInput"] = rest_field( + name="nicsToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of VM NIC to replicate. Required.""" + protected_disks: Optional[List["_models.VMwareToAzStackHCIProtectedDiskProperties"]] = rest_field( + name="protectedDisks", visibility=["read"] + ) + """Gets or sets the list of protected disks.""" + protected_nics: Optional[List["_models.VMwareToAzStackHCIProtectedNicProperties"]] = rest_field( + name="protectedNics", visibility=["read"] + ) + """Gets or sets the VM NIC details.""" + target_vm_bios_id: Optional[str] = rest_field(name="targetVmBiosId", visibility=["read"]) + """Gets or sets the BIOS Id of the target AzStackHCI VM.""" + target_vm_name: Optional[str] = rest_field( + name="targetVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target VM display name.""" + hyper_v_generation: str = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. + Required.""" + target_network_id: Optional[str] = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target network Id within AzStackHCI Cluster.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target test network Id within AzStackHCI Cluster.""" + target_cpu_cores: Optional[int] = rest_field( + name="targetCpuCores", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target CPU cores.""" + is_dynamic_ram: Optional[bool] = rest_field( + name="isDynamicRam", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether memory is dynamical.""" + dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = rest_field( + name="dynamicMemoryConfig", visibility=["read", "create", "update", "delete", "query"] + ) + """Protected item dynamic memory config.""" + target_memory_in_mega_bytes: Optional[int] = rest_field( + name="targetMemoryInMegaBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target memory in mega-bytes.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read"]) + """Gets or sets the type of the OS.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read"]) + """Gets or sets the name of the OS.""" + firmware_type: Optional[str] = rest_field(name="firmwareType", visibility=["read"]) + """Gets or sets the firmware type.""" + fabric_discovery_machine_id: str = rest_field( + name="fabricDiscoveryMachineId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ARM Id of the discovered machine. Required.""" + source_vm_name: Optional[str] = rest_field(name="sourceVmName", visibility=["read"]) + """Gets or sets the source VM display name.""" + source_cpu_cores: Optional[int] = rest_field(name="sourceCpuCores", visibility=["read"]) + """Gets or sets the source VM CPU cores.""" + source_memory_in_mega_bytes: Optional[float] = rest_field(name="sourceMemoryInMegaBytes", visibility=["read"]) + """Gets or sets the source VM ram memory size in megabytes.""" + run_as_account_id: str = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the run as account Id. Required.""" + source_fabric_agent_name: str = rest_field( + name="sourceFabricAgentName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the source fabric agent name. Required.""" + target_fabric_agent_name: str = rest_field( + name="targetFabricAgentName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target fabric agent name. Required.""" + source_appliance_name: Optional[str] = rest_field(name="sourceApplianceName", visibility=["read"]) + """Gets or sets the source appliance name.""" + target_appliance_name: Optional[str] = rest_field(name="targetApplianceName", visibility=["read"]) + """Gets or sets the target appliance name.""" + failover_recovery_point_id: Optional[str] = rest_field(name="failoverRecoveryPointId", visibility=["read"]) + """Gets or sets the recovery point Id to which the VM was failed over.""" + last_recovery_point_received: Optional[datetime.datetime] = rest_field( + name="lastRecoveryPointReceived", visibility=["read"], format="rfc3339" + ) + """Gets or sets the last recovery point received time.""" + last_recovery_point_id: Optional[str] = rest_field(name="lastRecoveryPointId", visibility=["read"]) + """Gets or sets the last recovery point Id.""" + initial_replication_progress_percentage: Optional[int] = rest_field( + name="initialReplicationProgressPercentage", visibility=["read"] + ) + """Gets or sets the initial replication progress percentage. This is calculated based on total + bytes processed for all disks in the source VM.""" + migration_progress_percentage: Optional[int] = rest_field(name="migrationProgressPercentage", visibility=["read"]) + """Gets or sets the migration progress percentage.""" + resume_progress_percentage: Optional[int] = rest_field(name="resumeProgressPercentage", visibility=["read"]) + """Gets or sets the resume progress percentage.""" + resync_progress_percentage: Optional[int] = rest_field(name="resyncProgressPercentage", visibility=["read"]) + """Gets or sets the resync progress percentage. This is calculated based on total bytes processed + for all disks in the source VM.""" + resync_retry_count: Optional[int] = rest_field(name="resyncRetryCount", visibility=["read"]) + """Gets or sets the resync retry count.""" + resync_required: Optional[bool] = rest_field(name="resyncRequired", visibility=["read"]) + """Gets or sets a value indicating whether resync is required.""" + resync_state: Optional[Union[str, "_models.VMwareToAzureMigrateResyncState"]] = rest_field( + name="resyncState", visibility=["read"] + ) + """Gets or sets the resync state. Known values are: \"None\", \"PreparedForResynchronization\", + and \"StartedResynchronization\".""" + perform_auto_resync: Optional[bool] = rest_field( + name="performAutoResync", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether auto resync is to be done.""" + resume_retry_count: Optional[int] = rest_field(name="resumeRetryCount", visibility=["read"]) + """Gets or sets the resume retry count.""" + last_replication_update_time: Optional[datetime.datetime] = rest_field( + name="lastReplicationUpdateTime", visibility=["read"], format="rfc3339" + ) + """Gets or sets the latest timestamp that replication status is updated.""" + instance_type: Literal["VMwareToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"VMwareToAzStackHCI\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + target_hci_cluster_id: str, + target_arc_cluster_custom_location_id: str, + storage_container_id: str, + target_resource_group_id: str, + custom_location_region: str, + disks_to_include: List["_models.VMwareToAzStackHCIDiskInput"], + nics_to_include: List["_models.VMwareToAzStackHCINicInput"], + hyper_v_generation: str, + fabric_discovery_machine_id: str, + run_as_account_id: str, + source_fabric_agent_name: str, + target_fabric_agent_name: str, + target_vm_name: Optional[str] = None, + target_network_id: Optional[str] = None, + test_network_id: Optional[str] = None, + target_cpu_cores: Optional[int] = None, + is_dynamic_ram: Optional[bool] = None, + dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = None, + target_memory_in_mega_bytes: Optional[int] = None, + perform_auto_resync: 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, instance_type="VMwareToAzStackHCI", **kwargs) + + +class VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate( + ProtectedItemModelCustomPropertiesUpdate, discriminator="VMwareToAzStackHCI" +): # pylint: disable=name-too-long + """VMware to AzStackHCI Protected item model custom properties. + + :ivar nics_to_include: Gets or sets the list of VM NIC to replicate. + :vartype nics_to_include: + list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCINicInput] + :ivar target_cpu_cores: Gets or sets the target CPU cores. + :vartype target_cpu_cores: int + :ivar is_dynamic_ram: Gets or sets a value indicating whether memory is dynamical. + :vartype is_dynamic_ram: bool + :ivar dynamic_memory_config: Protected item dynamic memory config. + :vartype dynamic_memory_config: + ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemDynamicMemoryConfig + :ivar target_memory_in_mega_bytes: Gets or sets the target memory in mega-bytes. + :vartype target_memory_in_mega_bytes: int + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "VMwareToAzStackHCI". + :vartype instance_type: str + :ivar os_type: Gets or sets the type of the OS. + :vartype os_type: str + """ + + nics_to_include: Optional[List["_models.VMwareToAzStackHCINicInput"]] = rest_field( + name="nicsToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of VM NIC to replicate.""" + target_cpu_cores: Optional[int] = rest_field( + name="targetCpuCores", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target CPU cores.""" + is_dynamic_ram: Optional[bool] = rest_field( + name="isDynamicRam", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether memory is dynamical.""" + dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = rest_field( + name="dynamicMemoryConfig", visibility=["read", "create", "update", "delete", "query"] + ) + """Protected item dynamic memory config.""" + target_memory_in_mega_bytes: Optional[int] = rest_field( + name="targetMemoryInMegaBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target memory in mega-bytes.""" + instance_type: Literal["VMwareToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"VMwareToAzStackHCI\".""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the type of the OS.""" + + @overload + def __init__( + self, + *, + nics_to_include: Optional[List["_models.VMwareToAzStackHCINicInput"]] = None, + target_cpu_cores: Optional[int] = None, + is_dynamic_ram: Optional[bool] = None, + dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = None, + target_memory_in_mega_bytes: Optional[int] = None, + os_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, instance_type="VMwareToAzStackHCI", **kwargs) + + +class VMwareToAzStackHCIProtectedNicProperties(_Model): + """VMwareToAzStackHCI NIC properties. + + :ivar nic_id: Gets or sets the NIC Id. + :vartype nic_id: str + :ivar mac_address: Gets or sets the NIC mac address. + :vartype mac_address: str + :ivar label: Gets or sets the NIC label. + :vartype label: str + :ivar is_primary_nic: Gets or sets a value indicating whether this is the primary NIC. + :vartype is_primary_nic: bool + :ivar network_name: Gets or sets the network name. + :vartype network_name: str + :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. + :vartype target_network_id: str + :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. + :vartype test_network_id: str + :ivar selection_type_for_failover: Gets or sets the selection type of the NIC. Known values + are: "NotSelected", "SelectedByUser", "SelectedByDefault", and "SelectedByUserOverride". + :vartype selection_type_for_failover: str or + ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection + """ + + nic_id: Optional[str] = rest_field(name="nicId", visibility=["read"]) + """Gets or sets the NIC Id.""" + mac_address: Optional[str] = rest_field(name="macAddress", visibility=["read"]) + """Gets or sets the NIC mac address.""" + label: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the NIC label.""" + is_primary_nic: Optional[bool] = rest_field( + name="isPrimaryNic", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether this is the primary NIC.""" + network_name: Optional[str] = rest_field(name="networkName", visibility=["read"]) + """Gets or sets the network name.""" + target_network_id: Optional[str] = rest_field(name="targetNetworkId", visibility=["read"]) + """Gets or sets the target network Id within AzStackHCI Cluster.""" + test_network_id: Optional[str] = rest_field(name="testNetworkId", visibility=["read"]) + """Gets or sets the target test network Id within AzStackHCI Cluster.""" + selection_type_for_failover: Optional[Union[str, "_models.VMNicSelection"]] = rest_field( + name="selectionTypeForFailover", visibility=["read"] + ) + """Gets or sets the selection type of the NIC. Known values are: \"NotSelected\", + \"SelectedByUser\", \"SelectedByDefault\", and \"SelectedByUserOverride\".""" + + @overload + def __init__( + self, + *, + is_primary_nic: 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 VMwareToAzStackHCIRecoveryPointModelCustomProperties( + RecoveryPointModelCustomProperties, discriminator="VMwareToAzStackHCIRecoveryPointModelCustomProperties" +): # pylint: disable=name-too-long + """VMware to AzStackHCI recovery point model custom properties. + + :ivar disk_ids: Gets or sets the list of the disk Ids. + :vartype disk_ids: list[str] + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "VMwareToAzStackHCIRecoveryPointModelCustomProperties". + :vartype instance_type: str + """ + + disk_ids: Optional[List[str]] = rest_field(name="diskIds", visibility=["read"]) + """Gets or sets the list of the disk Ids.""" + instance_type: Literal["VMwareToAzStackHCIRecoveryPointModelCustomProperties"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is + \"VMwareToAzStackHCIRecoveryPointModelCustomProperties\".""" + + @overload + def __init__( + self, + ) -> 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, instance_type="VMwareToAzStackHCIRecoveryPointModelCustomProperties", **kwargs) + + +class VMwareToAzStackHCIReplicationExtensionModelCustomProperties( + ReplicationExtensionModelCustomProperties, discriminator="VMwareToAzStackHCI" +): # pylint: disable=name-too-long + """VMware to AzStackHCI Replication extension model custom properties. + + :ivar vmware_fabric_arm_id: Gets or sets the ARM Id of the source VMware fabric. Required. + :vartype vmware_fabric_arm_id: str + :ivar vmware_site_id: Gets or sets the ARM Id of the VMware site. + :vartype vmware_site_id: str + :ivar az_stack_hci_fabric_arm_id: Gets or sets the ARM Id of the target AzStackHCI fabric. + Required. + :vartype az_stack_hci_fabric_arm_id: str + :ivar az_stack_hci_site_id: Gets or sets the ARM Id of the AzStackHCI site. + :vartype az_stack_hci_site_id: str + :ivar storage_account_id: Gets or sets the storage account Id. + :vartype storage_account_id: str + :ivar storage_account_sas_secret_name: Gets or sets the Sas Secret of storage account. + :vartype storage_account_sas_secret_name: str + :ivar asr_service_uri: Gets or sets the Uri of ASR. + :vartype asr_service_uri: str + :ivar rcm_service_uri: Gets or sets the Uri of Rcm. + :vartype rcm_service_uri: str + :ivar gateway_service_uri: Gets or sets the Uri of Gateway. + :vartype gateway_service_uri: str + :ivar source_gateway_service_id: Gets or sets the gateway service Id of source. + :vartype source_gateway_service_id: str + :ivar target_gateway_service_id: Gets or sets the gateway service Id of target. + :vartype target_gateway_service_id: str + :ivar source_storage_container_name: Gets or sets the source storage container name. + :vartype source_storage_container_name: str + :ivar target_storage_container_name: Gets or sets the target storage container name. + :vartype target_storage_container_name: str + :ivar resource_location: Gets or sets the resource location. + :vartype resource_location: str + :ivar subscription_id: Gets or sets the subscription. + :vartype subscription_id: str + :ivar resource_group: Gets or sets the resource group. + :vartype resource_group: str + :ivar instance_type: Gets or sets the instance type. Required. Default value is + "VMwareToAzStackHCI". + :vartype instance_type: str + """ + + vmware_fabric_arm_id: str = rest_field( + name="vmwareFabricArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ARM Id of the source VMware fabric. Required.""" + vmware_site_id: Optional[str] = rest_field(name="vmwareSiteId", visibility=["read"]) + """Gets or sets the ARM Id of the VMware site.""" + az_stack_hci_fabric_arm_id: str = rest_field( + name="azStackHciFabricArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ARM Id of the target AzStackHCI fabric. Required.""" + az_stack_hci_site_id: Optional[str] = rest_field(name="azStackHciSiteId", visibility=["read"]) + """Gets or sets the ARM Id of the AzStackHCI site.""" + storage_account_id: Optional[str] = rest_field( + name="storageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the storage account Id.""" + storage_account_sas_secret_name: Optional[str] = rest_field( + name="storageAccountSasSecretName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Sas Secret of storage account.""" + asr_service_uri: Optional[str] = rest_field(name="asrServiceUri", visibility=["read"]) + """Gets or sets the Uri of ASR.""" + rcm_service_uri: Optional[str] = rest_field(name="rcmServiceUri", visibility=["read"]) + """Gets or sets the Uri of Rcm.""" + gateway_service_uri: Optional[str] = rest_field(name="gatewayServiceUri", visibility=["read"]) + """Gets or sets the Uri of Gateway.""" + source_gateway_service_id: Optional[str] = rest_field(name="sourceGatewayServiceId", visibility=["read"]) + """Gets or sets the gateway service Id of source.""" + target_gateway_service_id: Optional[str] = rest_field(name="targetGatewayServiceId", visibility=["read"]) + """Gets or sets the gateway service Id of target.""" + source_storage_container_name: Optional[str] = rest_field(name="sourceStorageContainerName", visibility=["read"]) + """Gets or sets the source storage container name.""" + target_storage_container_name: Optional[str] = rest_field(name="targetStorageContainerName", visibility=["read"]) + """Gets or sets the target storage container name.""" + resource_location: Optional[str] = rest_field(name="resourceLocation", visibility=["read"]) + """Gets or sets the resource location.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId", visibility=["read"]) + """Gets or sets the subscription.""" + resource_group: Optional[str] = rest_field(name="resourceGroup", visibility=["read"]) + """Gets or sets the resource group.""" + instance_type: Literal["VMwareToAzStackHCI"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the instance type. Required. Default value is \"VMwareToAzStackHCI\".""" + + @overload + def __init__( + self, + *, + vmware_fabric_arm_id: str, + az_stack_hci_fabric_arm_id: str, + storage_account_id: Optional[str] = None, + storage_account_sas_secret_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, instance_type="VMwareToAzStackHCI", **kwargs) diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_models_py3.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_models_py3.py deleted file mode 100644 index a788a96de777..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_models_py3.py +++ /dev/null @@ -1,6411 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from .. import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AzStackHCIClusterProperties(_serialization.Model): - """AzStackHCI cluster properties. - - All required parameters must be populated in order to send to Azure. - - :ivar cluster_name: Gets or sets the AzStackHCICluster FQDN name. Required. - :vartype cluster_name: str - :ivar resource_name: Gets or sets the AzStackHCICluster resource name. Required. - :vartype resource_name: str - :ivar storage_account_name: Gets or sets the Storage account name. Required. - :vartype storage_account_name: str - :ivar storage_containers: Gets or sets the list of AzStackHCICluster Storage Container. - Required. - :vartype storage_containers: - list[~azure.mgmt.recoveryservicesdatareplication.models.StorageContainerProperties] - """ - - _validation = { - "cluster_name": {"required": True, "min_length": 1}, - "resource_name": {"required": True, "min_length": 1}, - "storage_account_name": {"required": True, "min_length": 1}, - "storage_containers": {"required": True}, - } - - _attribute_map = { - "cluster_name": {"key": "clusterName", "type": "str"}, - "resource_name": {"key": "resourceName", "type": "str"}, - "storage_account_name": {"key": "storageAccountName", "type": "str"}, - "storage_containers": {"key": "storageContainers", "type": "[StorageContainerProperties]"}, - } - - def __init__( - self, - *, - cluster_name: str, - resource_name: str, - storage_account_name: str, - storage_containers: List["_models.StorageContainerProperties"], - **kwargs: Any - ) -> None: - """ - :keyword cluster_name: Gets or sets the AzStackHCICluster FQDN name. Required. - :paramtype cluster_name: str - :keyword resource_name: Gets or sets the AzStackHCICluster resource name. Required. - :paramtype resource_name: str - :keyword storage_account_name: Gets or sets the Storage account name. Required. - :paramtype storage_account_name: str - :keyword storage_containers: Gets or sets the list of AzStackHCICluster Storage Container. - Required. - :paramtype storage_containers: - list[~azure.mgmt.recoveryservicesdatareplication.models.StorageContainerProperties] - """ - super().__init__(**kwargs) - self.cluster_name = cluster_name - self.resource_name = resource_name - self.storage_account_name = storage_account_name - self.storage_containers = storage_containers - - -class FabricModelCustomProperties(_serialization.Model): - """Fabric model custom properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzStackHCIFabricModelCustomProperties, HyperVMigrateFabricModelCustomProperties, - VMwareMigrateFabricModelCustomProperties - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "AzStackHCI": "AzStackHCIFabricModelCustomProperties", - "HyperVMigrate": "HyperVMigrateFabricModelCustomProperties", - "VMwareMigrate": "VMwareMigrateFabricModelCustomProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class AzStackHCIFabricModelCustomProperties(FabricModelCustomProperties): - """AzStackHCI fabric model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar az_stack_hci_site_id: Gets or sets the ARM Id of the AzStackHCI site. Required. - :vartype az_stack_hci_site_id: str - :ivar appliance_name: Gets or sets the Appliance name. - :vartype appliance_name: list[str] - :ivar cluster: AzStackHCI cluster properties. Required. - :vartype cluster: - ~azure.mgmt.recoveryservicesdatareplication.models.AzStackHCIClusterProperties - :ivar fabric_resource_id: Gets or sets the fabric resource Id. - :vartype fabric_resource_id: str - :ivar fabric_container_id: Gets or sets the fabric container Id. - :vartype fabric_container_id: str - :ivar migration_solution_id: Gets or sets the Migration solution ARM Id. Required. - :vartype migration_solution_id: str - :ivar migration_hub_uri: Gets or sets the migration hub Uri. - :vartype migration_hub_uri: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "az_stack_hci_site_id": {"required": True, "min_length": 1}, - "appliance_name": {"readonly": True}, - "cluster": {"required": True}, - "fabric_resource_id": {"readonly": True}, - "fabric_container_id": {"readonly": True}, - "migration_solution_id": {"required": True, "min_length": 1}, - "migration_hub_uri": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "az_stack_hci_site_id": {"key": "azStackHciSiteId", "type": "str"}, - "appliance_name": {"key": "applianceName", "type": "[str]"}, - "cluster": {"key": "cluster", "type": "AzStackHCIClusterProperties"}, - "fabric_resource_id": {"key": "fabricResourceId", "type": "str"}, - "fabric_container_id": {"key": "fabricContainerId", "type": "str"}, - "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, - "migration_hub_uri": {"key": "migrationHubUri", "type": "str"}, - } - - def __init__( - self, - *, - az_stack_hci_site_id: str, - cluster: "_models.AzStackHCIClusterProperties", - migration_solution_id: str, - **kwargs: Any - ) -> None: - """ - :keyword az_stack_hci_site_id: Gets or sets the ARM Id of the AzStackHCI site. Required. - :paramtype az_stack_hci_site_id: str - :keyword cluster: AzStackHCI cluster properties. Required. - :paramtype cluster: - ~azure.mgmt.recoveryservicesdatareplication.models.AzStackHCIClusterProperties - :keyword migration_solution_id: Gets or sets the Migration solution ARM Id. Required. - :paramtype migration_solution_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "AzStackHCI" - self.az_stack_hci_site_id = az_stack_hci_site_id - self.appliance_name = None - self.cluster = cluster - self.fabric_resource_id = None - self.fabric_container_id = None - self.migration_solution_id = migration_solution_id - self.migration_hub_uri = None - - -class CheckNameAvailabilityModel(_serialization.Model): - """Check name availability model. - - :ivar name: Gets or sets the resource name. - :vartype name: str - :ivar type: Gets or sets the resource type. - :vartype type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the resource name. - :paramtype name: str - :keyword type: Gets or sets the resource type. - :paramtype type: str - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class CheckNameAvailabilityResponseModel(_serialization.Model): - """Check name availability response model. - - :ivar name_available: Gets or sets a value indicating whether resource name is available or - not. - :vartype name_available: bool - :ivar reason: Gets or sets the reason for resource name unavailability. - :vartype reason: str - :ivar message: Gets or sets the message for resource name unavailability. - :vartype message: str - """ - - _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__( - self, - *, - name_available: Optional[bool] = None, - reason: Optional[str] = None, - message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name_available: Gets or sets a value indicating whether resource name is available or - not. - :paramtype name_available: bool - :keyword reason: Gets or sets the reason for resource name unavailability. - :paramtype reason: str - :keyword message: Gets or sets the message for resource name unavailability. - :paramtype message: str - """ - super().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class DeploymentPreflightModel(_serialization.Model): - """Deployment preflight model. - - :ivar resources: Gets or sets the list of resources. - :vartype resources: - list[~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightResource] - """ - - _attribute_map = { - "resources": {"key": "resources", "type": "[DeploymentPreflightResource]"}, - } - - def __init__( - self, *, resources: Optional[List["_models.DeploymentPreflightResource"]] = None, **kwargs: Any - ) -> None: - """ - :keyword resources: Gets or sets the list of resources. - :paramtype resources: - list[~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightResource] - """ - super().__init__(**kwargs) - self.resources = resources - - -class DeploymentPreflightResource(_serialization.Model): - """Deployment preflight resource. - - :ivar name: Gets or sets the resource name. - :vartype name: str - :ivar type: Gets or sets the resource type. - :vartype type: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :ivar api_version: Gets or sets the Api version. - :vartype api_version: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "api_version": {"key": "apiVersion", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[str] = None, - location: Optional[str] = None, - api_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the resource name. - :paramtype name: str - :keyword type: Gets or sets the resource type. - :paramtype type: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword api_version: Gets or sets the Api version. - :paramtype api_version: str - """ - super().__init__(**kwargs) - self.name = name - self.type = type - self.location = location - self.api_version = api_version - - -class DraModel(_serialization.Model): - """Dra model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Dra model properties. Required. - :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.DraModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: ~azure.mgmt.recoveryservicesdatareplication.models.DraModelSystemData - """ - - _validation = { - "properties": {"required": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "DraModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "DraModelSystemData"}, - } - - def __init__(self, *, properties: "_models.DraModelProperties", **kwargs: Any) -> None: - """ - :keyword properties: Dra model properties. Required. - :paramtype properties: ~azure.mgmt.recoveryservicesdatareplication.models.DraModelProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class DraModelCollection(_serialization.Model): - """Dra model collection. - - :ivar value: Gets or sets the list of Dras. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DraModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.DraModel"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of Dras. - :paramtype value: list[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DraModelCustomProperties(_serialization.Model): - """Dra model custom properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - VMwareDraModelCustomProperties - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"VMware": "VMwareDraModelCustomProperties"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class DraModelProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Dra model properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar correlation_id: Gets or sets the Dra correlation Id. - :vartype correlation_id: str - :ivar machine_id: Gets or sets the machine Id where Dra is running. Required. - :vartype machine_id: str - :ivar machine_name: Gets or sets the machine name where Dra is running. Required. - :vartype machine_name: str - :ivar authentication_identity: Identity model. Required. - :vartype authentication_identity: - ~azure.mgmt.recoveryservicesdatareplication.models.IdentityModel - :ivar resource_access_identity: Identity model. Required. - :vartype resource_access_identity: - ~azure.mgmt.recoveryservicesdatareplication.models.IdentityModel - :ivar is_responsive: Gets or sets a value indicating whether Dra is responsive. - :vartype is_responsive: bool - :ivar last_heartbeat: Gets or sets the time when last heartbeat was sent by the Dra. - :vartype last_heartbeat: ~datetime.datetime - :ivar version_number: Gets or sets the Dra version. - :vartype version_number: str - :ivar provisioning_state: Gets or sets the provisioning state of the Dra. Known values are: - "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState - :ivar health_errors: Gets or sets the list of health errors. - :vartype health_errors: - list[~azure.mgmt.recoveryservicesdatareplication.models.HealthErrorModel] - :ivar custom_properties: Dra model custom properties. Required. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.DraModelCustomProperties - """ - - _validation = { - "correlation_id": {"readonly": True}, - "machine_id": {"required": True, "min_length": 1}, - "machine_name": {"required": True, "min_length": 1}, - "authentication_identity": {"required": True}, - "resource_access_identity": {"required": True}, - "is_responsive": {"readonly": True}, - "last_heartbeat": {"readonly": True}, - "version_number": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "health_errors": {"readonly": True}, - "custom_properties": {"required": True}, - } - - _attribute_map = { - "correlation_id": {"key": "correlationId", "type": "str"}, - "machine_id": {"key": "machineId", "type": "str"}, - "machine_name": {"key": "machineName", "type": "str"}, - "authentication_identity": {"key": "authenticationIdentity", "type": "IdentityModel"}, - "resource_access_identity": {"key": "resourceAccessIdentity", "type": "IdentityModel"}, - "is_responsive": {"key": "isResponsive", "type": "bool"}, - "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, - "version_number": {"key": "versionNumber", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthErrorModel]"}, - "custom_properties": {"key": "customProperties", "type": "DraModelCustomProperties"}, - } - - def __init__( - self, - *, - machine_id: str, - machine_name: str, - authentication_identity: "_models.IdentityModel", - resource_access_identity: "_models.IdentityModel", - custom_properties: "_models.DraModelCustomProperties", - **kwargs: Any - ) -> None: - """ - :keyword machine_id: Gets or sets the machine Id where Dra is running. Required. - :paramtype machine_id: str - :keyword machine_name: Gets or sets the machine name where Dra is running. Required. - :paramtype machine_name: str - :keyword authentication_identity: Identity model. Required. - :paramtype authentication_identity: - ~azure.mgmt.recoveryservicesdatareplication.models.IdentityModel - :keyword resource_access_identity: Identity model. Required. - :paramtype resource_access_identity: - ~azure.mgmt.recoveryservicesdatareplication.models.IdentityModel - :keyword custom_properties: Dra model custom properties. Required. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.DraModelCustomProperties - """ - super().__init__(**kwargs) - self.correlation_id = None - self.machine_id = machine_id - self.machine_name = machine_name - self.authentication_identity = authentication_identity - self.resource_access_identity = resource_access_identity - self.is_responsive = None - self.last_heartbeat = None - self.version_number = None - self.provisioning_state = None - self.health_errors = None - self.custom_properties = custom_properties - - -class SystemDataModel(_serialization.Model): - """System data required to be defined for Azure resources. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class DraModelSystemData(SystemDataModel): - """DraModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class EmailConfigurationModel(_serialization.Model): - """Email configuration model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Email configuration model properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: - ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModelSystemData - """ - - _validation = { - "properties": {"required": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "EmailConfigurationModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "EmailConfigurationModelSystemData"}, - } - - def __init__(self, *, properties: "_models.EmailConfigurationModelProperties", **kwargs: Any) -> None: - """ - :keyword properties: Email configuration model properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModelProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class EmailConfigurationModelCollection(_serialization.Model): - """Email configuration model collection. - - :ivar value: Gets or sets the list of email configurations. - :vartype value: - list[~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[EmailConfigurationModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.EmailConfigurationModel"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of email configurations. - :paramtype value: - list[~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class EmailConfigurationModelProperties(_serialization.Model): - """Email configuration model properties. - - All required parameters must be populated in order to send to Azure. - - :ivar send_to_owners: Gets or sets a value indicating whether to send email to subscription - administrator. Required. - :vartype send_to_owners: bool - :ivar custom_email_addresses: Gets or sets the custom email address for sending emails. - :vartype custom_email_addresses: list[str] - :ivar locale: Gets or sets the locale for the email notification. - :vartype locale: str - """ - - _validation = { - "send_to_owners": {"required": True}, - } - - _attribute_map = { - "send_to_owners": {"key": "sendToOwners", "type": "bool"}, - "custom_email_addresses": {"key": "customEmailAddresses", "type": "[str]"}, - "locale": {"key": "locale", "type": "str"}, - } - - def __init__( - self, - *, - send_to_owners: bool, - custom_email_addresses: Optional[List[str]] = None, - locale: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword send_to_owners: Gets or sets a value indicating whether to send email to subscription - administrator. Required. - :paramtype send_to_owners: bool - :keyword custom_email_addresses: Gets or sets the custom email address for sending emails. - :paramtype custom_email_addresses: list[str] - :keyword locale: Gets or sets the locale for the email notification. - :paramtype locale: str - """ - super().__init__(**kwargs) - self.send_to_owners = send_to_owners - self.custom_email_addresses = custom_email_addresses - self.locale = locale - - -class EmailConfigurationModelSystemData(SystemDataModel): - """EmailConfigurationModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.recoveryservicesdatareplication.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.recoveryservicesdatareplication.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorModel(_serialization.Model): - """Error model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Gets or sets the error code. - :vartype code: str - :ivar type: Gets or sets the error type. - :vartype type: str - :ivar severity: Gets or sets the error severity. - :vartype severity: str - :ivar creation_time: Gets or sets the creation time of error. - :vartype creation_time: ~datetime.datetime - :ivar message: Gets or sets the error message. - :vartype message: str - :ivar causes: Gets or sets the possible causes of error. - :vartype causes: str - :ivar recommendation: Gets or sets the recommended action to resolve error. - :vartype recommendation: str - """ - - _validation = { - "code": {"readonly": True}, - "type": {"readonly": True}, - "severity": {"readonly": True}, - "creation_time": {"readonly": True}, - "message": {"readonly": True}, - "causes": {"readonly": True}, - "recommendation": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "creation_time": {"key": "creationTime", "type": "iso-8601"}, - "message": {"key": "message", "type": "str"}, - "causes": {"key": "causes", "type": "str"}, - "recommendation": {"key": "recommendation", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.type = None - self.severity = None - self.creation_time = None - self.message = None - self.causes = None - self.recommendation = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.recoveryservicesdatareplication.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.recoveryservicesdatareplication.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class EventModel(_serialization.Model): - """Event model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Event model properties. Required. - :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.EventModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: ~azure.mgmt.recoveryservicesdatareplication.models.EventModelSystemData - """ - - _validation = { - "properties": {"required": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "EventModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "EventModelSystemData"}, - } - - def __init__(self, *, properties: "_models.EventModelProperties", **kwargs: Any) -> None: - """ - :keyword properties: Event model properties. Required. - :paramtype properties: ~azure.mgmt.recoveryservicesdatareplication.models.EventModelProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class EventModelCollection(_serialization.Model): - """Event model collection. - - :ivar value: Gets or sets the list of events. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.EventModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[EventModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.EventModel"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of events. - :paramtype value: list[~azure.mgmt.recoveryservicesdatareplication.models.EventModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class EventModelCustomProperties(_serialization.Model): - """Event model custom properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HyperVToAzStackHCIEventModelCustomProperties - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"HyperVToAzStackHCI": "HyperVToAzStackHCIEventModelCustomProperties"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class EventModelProperties(_serialization.Model): - """Event model properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_type: Gets or sets the resource type. - :vartype resource_type: str - :ivar resource_name: Gets or sets the resource name. - :vartype resource_name: str - :ivar event_type: Gets or sets the event type. - :vartype event_type: str - :ivar event_name: Gets or sets the event name. - :vartype event_name: str - :ivar time_of_occurrence: Gets or sets the time at which the event occurred at source. - :vartype time_of_occurrence: ~datetime.datetime - :ivar severity: Gets or sets the event severity. - :vartype severity: str - :ivar description: Gets or sets the event description. - :vartype description: str - :ivar correlation_id: Gets or sets the event correlation Id. - :vartype correlation_id: str - :ivar health_errors: Gets or sets the errors associated with this event. - :vartype health_errors: - list[~azure.mgmt.recoveryservicesdatareplication.models.HealthErrorModel] - :ivar custom_properties: Event model custom properties. Required. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.EventModelCustomProperties - """ - - _validation = { - "resource_type": {"readonly": True}, - "resource_name": {"readonly": True}, - "event_type": {"readonly": True}, - "event_name": {"readonly": True}, - "time_of_occurrence": {"readonly": True}, - "severity": {"readonly": True}, - "description": {"readonly": True}, - "correlation_id": {"readonly": True}, - "health_errors": {"readonly": True}, - "custom_properties": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "resource_name": {"key": "resourceName", "type": "str"}, - "event_type": {"key": "eventType", "type": "str"}, - "event_name": {"key": "eventName", "type": "str"}, - "time_of_occurrence": {"key": "timeOfOccurrence", "type": "iso-8601"}, - "severity": {"key": "severity", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthErrorModel]"}, - "custom_properties": {"key": "customProperties", "type": "EventModelCustomProperties"}, - } - - def __init__(self, *, custom_properties: "_models.EventModelCustomProperties", **kwargs: Any) -> None: - """ - :keyword custom_properties: Event model custom properties. Required. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.EventModelCustomProperties - """ - super().__init__(**kwargs) - self.resource_type = None - self.resource_name = None - self.event_type = None - self.event_name = None - self.time_of_occurrence = None - self.severity = None - self.description = None - self.correlation_id = None - self.health_errors = None - self.custom_properties = custom_properties - - -class EventModelSystemData(SystemDataModel): - """EventModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class FabricModel(_serialization.Model): - """Fabric model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar location: Gets or sets the location of the fabric. Required. - :vartype location: str - :ivar tags: Gets or sets the resource tags. - :vartype tags: dict[str, str] - :ivar properties: Fabric model properties. Required. - :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelSystemData - """ - - _validation = { - "location": {"required": True, "min_length": 1}, - "properties": {"required": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "FabricModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "FabricModelSystemData"}, - } - - def __init__( - self, - *, - location: str, - properties: "_models.FabricModelProperties", - tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Gets or sets the location of the fabric. Required. - :paramtype location: str - :keyword tags: Gets or sets the resource tags. - :paramtype tags: dict[str, str] - :keyword properties: Fabric model properties. Required. - :paramtype properties: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelProperties - """ - super().__init__(**kwargs) - self.location = location - self.tags = tags - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class FabricModelCollection(_serialization.Model): - """Fabric model collection. - - :ivar value: Gets or sets the list of fabrics. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[FabricModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.FabricModel"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of fabrics. - :paramtype value: list[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FabricModelProperties(_serialization.Model): - """Fabric model properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar provisioning_state: Gets or sets the provisioning state of the fabric. Known values are: - "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState - :ivar service_endpoint: Gets or sets the service endpoint. - :vartype service_endpoint: str - :ivar service_resource_id: Gets or sets the service resource Id. - :vartype service_resource_id: str - :ivar health: Gets or sets the fabric health. Known values are: "Normal", "Warning", and - "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicesdatareplication.models.HealthStatus - :ivar health_errors: Gets or sets the list of health errors. - :vartype health_errors: - list[~azure.mgmt.recoveryservicesdatareplication.models.HealthErrorModel] - :ivar custom_properties: Fabric model custom properties. Required. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelCustomProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "service_endpoint": {"readonly": True}, - "service_resource_id": {"readonly": True}, - "health": {"readonly": True}, - "health_errors": {"readonly": True}, - "custom_properties": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "service_endpoint": {"key": "serviceEndpoint", "type": "str"}, - "service_resource_id": {"key": "serviceResourceId", "type": "str"}, - "health": {"key": "health", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthErrorModel]"}, - "custom_properties": {"key": "customProperties", "type": "FabricModelCustomProperties"}, - } - - def __init__(self, *, custom_properties: "_models.FabricModelCustomProperties", **kwargs: Any) -> None: - """ - :keyword custom_properties: Fabric model custom properties. Required. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelCustomProperties - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.service_endpoint = None - self.service_resource_id = None - self.health = None - self.health_errors = None - self.custom_properties = custom_properties - - -class FabricModelSystemData(SystemDataModel): - """FabricModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class FabricModelUpdate(_serialization.Model): - """Fabric model for update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: Gets or sets the resource tags. - :vartype tags: dict[str, str] - :ivar properties: Fabric model properties. - :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: - ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdateSystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "FabricModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "FabricModelUpdateSystemData"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.FabricModelProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Gets or sets the resource tags. - :paramtype tags: dict[str, str] - :keyword properties: Fabric model properties. - :paramtype properties: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class FabricModelUpdateSystemData(SystemDataModel): - """FabricModelUpdateSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class FailoverProtectedItemProperties(_serialization.Model): - """Failover properties of the protected item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar protected_item_name: Gets or sets the protected item name. - :vartype protected_item_name: str - :ivar vm_name: Gets or sets the VM name. - :vartype vm_name: str - :ivar test_vm_name: Gets or sets the test VM name. - :vartype test_vm_name: str - :ivar recovery_point_id: Gets or sets the recovery point Id. - :vartype recovery_point_id: str - :ivar recovery_point_time: Gets or sets the recovery point time. - :vartype recovery_point_time: ~datetime.datetime - :ivar network_name: Gets or sets the network name. - :vartype network_name: str - :ivar subnet: Gets or sets the network subnet. - :vartype subnet: str - """ - - _validation = { - "protected_item_name": {"readonly": True}, - "vm_name": {"readonly": True}, - "test_vm_name": {"readonly": True}, - "recovery_point_id": {"readonly": True}, - "recovery_point_time": {"readonly": True}, - "network_name": {"readonly": True}, - "subnet": {"readonly": True}, - } - - _attribute_map = { - "protected_item_name": {"key": "protectedItemName", "type": "str"}, - "vm_name": {"key": "vmName", "type": "str"}, - "test_vm_name": {"key": "testVmName", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, - "network_name": {"key": "networkName", "type": "str"}, - "subnet": {"key": "subnet", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protected_item_name = None - self.vm_name = None - self.test_vm_name = None - self.recovery_point_id = None - self.recovery_point_time = None - self.network_name = None - self.subnet = None - - -class WorkflowModelCustomProperties(_serialization.Model): - """Workflow model custom properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - FailoverWorkflowModelCustomProperties, TestFailoverCleanupWorkflowModelCustomProperties, - TestFailoverWorkflowModelCustomProperties - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar affected_object_details: Gets or sets any custom properties of the affected object. - :vartype affected_object_details: dict[str, str] - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "affected_object_details": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - } - - _subtype_map = { - "instance_type": { - "FailoverWorkflowDetails": "FailoverWorkflowModelCustomProperties", - "TestFailoverCleanupWorkflowDetails": "TestFailoverCleanupWorkflowModelCustomProperties", - "TestFailoverWorkflowDetails": "TestFailoverWorkflowModelCustomProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - self.affected_object_details = None - - -class FailoverWorkflowModelCustomProperties(WorkflowModelCustomProperties): - """Failover workflow model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar affected_object_details: Gets or sets any custom properties of the affected object. - :vartype affected_object_details: dict[str, str] - :ivar protected_item_details: Gets or sets the failed over protected item details. - :vartype protected_item_details: - list[~azure.mgmt.recoveryservicesdatareplication.models.FailoverProtectedItemProperties] - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "affected_object_details": {"readonly": True}, - "protected_item_details": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "protected_item_details": {"key": "protectedItemDetails", "type": "[FailoverProtectedItemProperties]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "FailoverWorkflowDetails" - self.protected_item_details = None - - -class HealthErrorModel(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Health error model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar affected_resource_type: Gets or sets the type of affected resource type. - :vartype affected_resource_type: str - :ivar affected_resource_correlation_ids: Gets or sets the list of affected resource correlation - Ids. This can be used to - uniquely identify the count of items affected by a specific category and severity - as well as count of item affected by an specific issue. - :vartype affected_resource_correlation_ids: list[str] - :ivar child_errors: Gets or sets a list of child health errors associated with this error. - :vartype child_errors: - list[~azure.mgmt.recoveryservicesdatareplication.models.InnerHealthErrorModel] - :ivar code: Gets or sets the error code. - :vartype code: str - :ivar health_category: Gets or sets the health category. - :vartype health_category: str - :ivar category: Gets or sets the error category. - :vartype category: str - :ivar severity: Gets or sets the error severity. - :vartype severity: str - :ivar source: Gets or sets the error source. - :vartype source: str - :ivar creation_time: Gets or sets the error creation time. - :vartype creation_time: ~datetime.datetime - :ivar is_customer_resolvable: Gets or sets a value indicating whether the error is customer - resolvable. - :vartype is_customer_resolvable: bool - :ivar summary: Gets or sets the error summary. - :vartype summary: str - :ivar message: Gets or sets the error message. - :vartype message: str - :ivar causes: Gets or sets possible causes of the error. - :vartype causes: str - :ivar recommendation: Gets or sets recommended action to resolve the error. - :vartype recommendation: str - """ - - _validation = { - "code": {"readonly": True}, - "health_category": {"readonly": True}, - "category": {"readonly": True}, - "severity": {"readonly": True}, - "source": {"readonly": True}, - "creation_time": {"readonly": True}, - "is_customer_resolvable": {"readonly": True}, - "summary": {"readonly": True}, - "message": {"readonly": True}, - "causes": {"readonly": True}, - "recommendation": {"readonly": True}, - } - - _attribute_map = { - "affected_resource_type": {"key": "affectedResourceType", "type": "str"}, - "affected_resource_correlation_ids": {"key": "affectedResourceCorrelationIds", "type": "[str]"}, - "child_errors": {"key": "childErrors", "type": "[InnerHealthErrorModel]"}, - "code": {"key": "code", "type": "str"}, - "health_category": {"key": "healthCategory", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "source": {"key": "source", "type": "str"}, - "creation_time": {"key": "creationTime", "type": "iso-8601"}, - "is_customer_resolvable": {"key": "isCustomerResolvable", "type": "bool"}, - "summary": {"key": "summary", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "causes": {"key": "causes", "type": "str"}, - "recommendation": {"key": "recommendation", "type": "str"}, - } - - def __init__( - self, - *, - affected_resource_type: Optional[str] = None, - affected_resource_correlation_ids: Optional[List[str]] = None, - child_errors: Optional[List["_models.InnerHealthErrorModel"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword affected_resource_type: Gets or sets the type of affected resource type. - :paramtype affected_resource_type: str - :keyword affected_resource_correlation_ids: Gets or sets the list of affected resource - correlation Ids. This can be used to - uniquely identify the count of items affected by a specific category and severity - as well as count of item affected by an specific issue. - :paramtype affected_resource_correlation_ids: list[str] - :keyword child_errors: Gets or sets a list of child health errors associated with this error. - :paramtype child_errors: - list[~azure.mgmt.recoveryservicesdatareplication.models.InnerHealthErrorModel] - """ - super().__init__(**kwargs) - self.affected_resource_type = affected_resource_type - self.affected_resource_correlation_ids = affected_resource_correlation_ids - self.child_errors = child_errors - self.code = None - self.health_category = None - self.category = None - self.severity = None - self.source = None - self.creation_time = None - self.is_customer_resolvable = None - self.summary = None - self.message = None - self.causes = None - self.recommendation = None - - -class HyperVMigrateFabricModelCustomProperties(FabricModelCustomProperties): - """HyperV migrate fabric model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar hyper_v_site_id: Gets or sets the ARM Id of the HyperV site. Required. - :vartype hyper_v_site_id: str - :ivar fabric_resource_id: Gets or sets the fabric resource Id. - :vartype fabric_resource_id: str - :ivar fabric_container_id: Gets or sets the fabric container Id. - :vartype fabric_container_id: str - :ivar migration_solution_id: Gets or sets the migration solution ARM Id. Required. - :vartype migration_solution_id: str - :ivar migration_hub_uri: Gets or sets the migration hub Uri. - :vartype migration_hub_uri: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "hyper_v_site_id": {"required": True, "min_length": 1}, - "fabric_resource_id": {"readonly": True}, - "fabric_container_id": {"readonly": True}, - "migration_solution_id": {"required": True, "min_length": 1}, - "migration_hub_uri": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "hyper_v_site_id": {"key": "hyperVSiteId", "type": "str"}, - "fabric_resource_id": {"key": "fabricResourceId", "type": "str"}, - "fabric_container_id": {"key": "fabricContainerId", "type": "str"}, - "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, - "migration_hub_uri": {"key": "migrationHubUri", "type": "str"}, - } - - def __init__(self, *, hyper_v_site_id: str, migration_solution_id: str, **kwargs: Any) -> None: - """ - :keyword hyper_v_site_id: Gets or sets the ARM Id of the HyperV site. Required. - :paramtype hyper_v_site_id: str - :keyword migration_solution_id: Gets or sets the migration solution ARM Id. Required. - :paramtype migration_solution_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVMigrate" - self.hyper_v_site_id = hyper_v_site_id - self.fabric_resource_id = None - self.fabric_container_id = None - self.migration_solution_id = migration_solution_id - self.migration_hub_uri = None - - -class HyperVToAzStackHCIDiskInput(_serialization.Model): - """HyperVToAzStack disk input. - - All required parameters must be populated in order to send to Azure. - - :ivar disk_id: Gets or sets the disk Id. Required. - :vartype disk_id: str - :ivar storage_container_id: Gets or sets the target storage account ARM Id. - :vartype storage_container_id: str - :ivar is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the - virtual hard - disk. - :vartype is_dynamic: bool - :ivar disk_size_gb: Gets or sets the disk size in GB. Required. - :vartype disk_size_gb: int - :ivar disk_file_format: Gets or sets the type of the virtual hard disk, vhd or vhdx. Required. - :vartype disk_file_format: str - :ivar is_os_disk: Gets or sets a value indicating whether disk is os disk. Required. - :vartype is_os_disk: bool - """ - - _validation = { - "disk_id": {"required": True, "min_length": 1}, - "disk_size_gb": {"required": True}, - "disk_file_format": {"required": True, "min_length": 1}, - "is_os_disk": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "storage_container_id": {"key": "storageContainerId", "type": "str"}, - "is_dynamic": {"key": "isDynamic", "type": "bool"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "disk_file_format": {"key": "diskFileFormat", "type": "str"}, - "is_os_disk": {"key": "isOsDisk", "type": "bool"}, - } - - def __init__( - self, - *, - disk_id: str, - disk_size_gb: int, - disk_file_format: str, - is_os_disk: bool, - storage_container_id: Optional[str] = None, - is_dynamic: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: Gets or sets the disk Id. Required. - :paramtype disk_id: str - :keyword storage_container_id: Gets or sets the target storage account ARM Id. - :paramtype storage_container_id: str - :keyword is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the - virtual hard - disk. - :paramtype is_dynamic: bool - :keyword disk_size_gb: Gets or sets the disk size in GB. Required. - :paramtype disk_size_gb: int - :keyword disk_file_format: Gets or sets the type of the virtual hard disk, vhd or vhdx. - Required. - :paramtype disk_file_format: str - :keyword is_os_disk: Gets or sets a value indicating whether disk is os disk. Required. - :paramtype is_os_disk: bool - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.storage_container_id = storage_container_id - self.is_dynamic = is_dynamic - self.disk_size_gb = disk_size_gb - self.disk_file_format = disk_file_format - self.is_os_disk = is_os_disk - - -class HyperVToAzStackHCIEventModelCustomProperties(EventModelCustomProperties): - """HyperV to AzStackHCI event model custom properties. This class provides provider specific - details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and - DataContract.HealthEvents.HealthEventType.AgentHealth. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar event_source_friendly_name: Gets or sets the friendly name of the source which has raised - this health event. - :vartype event_source_friendly_name: str - :ivar protected_item_friendly_name: Gets or sets the protected item friendly name. - :vartype protected_item_friendly_name: str - :ivar source_appliance_name: Gets or sets the source appliance name. - :vartype source_appliance_name: str - :ivar target_appliance_name: Gets or sets the source target name. - :vartype target_appliance_name: str - :ivar server_type: Gets or sets the server type. - :vartype server_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "event_source_friendly_name": {"readonly": True}, - "protected_item_friendly_name": {"readonly": True}, - "source_appliance_name": {"readonly": True}, - "target_appliance_name": {"readonly": True}, - "server_type": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "event_source_friendly_name": {"key": "eventSourceFriendlyName", "type": "str"}, - "protected_item_friendly_name": {"key": "protectedItemFriendlyName", "type": "str"}, - "source_appliance_name": {"key": "sourceApplianceName", "type": "str"}, - "target_appliance_name": {"key": "targetApplianceName", "type": "str"}, - "server_type": {"key": "serverType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVToAzStackHCI" - self.event_source_friendly_name = None - self.protected_item_friendly_name = None - self.source_appliance_name = None - self.target_appliance_name = None - self.server_type = None - - -class HyperVToAzStackHCINicInput(_serialization.Model): - """HyperVToAzStackHCI NIC properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar nic_id: Gets or sets the NIC Id. Required. - :vartype nic_id: str - :ivar network_name: Gets or sets the network name. - :vartype network_name: str - :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - Required. - :vartype target_network_id: str - :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - Required. - :vartype test_network_id: str - :ivar selection_type_for_failover: Gets or sets the selection type of the NIC. Required. Known - values are: "NotSelected", "SelectedByUser", "SelectedByDefault", and "SelectedByUserOverride". - :vartype selection_type_for_failover: str or - ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection - """ - - _validation = { - "nic_id": {"required": True, "min_length": 1}, - "network_name": {"readonly": True}, - "target_network_id": {"required": True, "min_length": 1}, - "test_network_id": {"required": True, "min_length": 1}, - "selection_type_for_failover": {"required": True}, - } - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "network_name": {"key": "networkName", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "selection_type_for_failover": {"key": "selectionTypeForFailover", "type": "str"}, - } - - def __init__( - self, - *, - nic_id: str, - target_network_id: str, - test_network_id: str, - selection_type_for_failover: Union[str, "_models.VMNicSelection"], - **kwargs: Any - ) -> None: - """ - :keyword nic_id: Gets or sets the NIC Id. Required. - :paramtype nic_id: str - :keyword target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - Required. - :paramtype target_network_id: str - :keyword test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - Required. - :paramtype test_network_id: str - :keyword selection_type_for_failover: Gets or sets the selection type of the NIC. Required. - Known values are: "NotSelected", "SelectedByUser", "SelectedByDefault", and - "SelectedByUserOverride". - :paramtype selection_type_for_failover: str or - ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection - """ - super().__init__(**kwargs) - self.nic_id = nic_id - self.network_name = None - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.selection_type_for_failover = selection_type_for_failover - - -class PlannedFailoverModelCustomProperties(_serialization.Model): - """Planned failover model custom properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HyperVToAzStackHCIPlannedFailoverModelCustomProperties, - VMwareToAzStackHCIPlannedFailoverModelCustomProperties - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "HyperVToAzStackHCI": "HyperVToAzStackHCIPlannedFailoverModelCustomProperties", - "VMwareToAzStackHCI": "VMwareToAzStackHCIPlannedFailoverModelCustomProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class HyperVToAzStackHCIPlannedFailoverModelCustomProperties(PlannedFailoverModelCustomProperties): - """HyperV to AzStackHCI planned failover model custom properties. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar shutdown_source_vm: Gets or sets a value indicating whether VM needs to be shut down. - Required. - :vartype shutdown_source_vm: bool - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "shutdown_source_vm": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "shutdown_source_vm": {"key": "shutdownSourceVM", "type": "bool"}, - } - - def __init__(self, *, shutdown_source_vm: bool, **kwargs: Any) -> None: - """ - :keyword shutdown_source_vm: Gets or sets a value indicating whether VM needs to be shut down. - Required. - :paramtype shutdown_source_vm: bool - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVToAzStackHCI" - self.shutdown_source_vm = shutdown_source_vm - - -class PolicyModelCustomProperties(_serialization.Model): - """Policy model custom properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HyperVToAzStackHCIPolicyModelCustomProperties, VMwareToAzStackHCIPolicyModelCustomProperties - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "HyperVToAzStackHCI": "HyperVToAzStackHCIPolicyModelCustomProperties", - "VMwareToAzStackHCI": "VMwareToAzStackHCIPolicyModelCustomProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class HyperVToAzStackHCIPolicyModelCustomProperties(PolicyModelCustomProperties): - """HyperV To AzStackHCI Policy model custom properties. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar recovery_point_history_in_minutes: Gets or sets the duration in minutes until which the - recovery points need to be - stored. Required. - :vartype recovery_point_history_in_minutes: int - :ivar crash_consistent_frequency_in_minutes: Gets or sets the crash consistent snapshot - frequency (in minutes). Required. - :vartype crash_consistent_frequency_in_minutes: int - :ivar app_consistent_frequency_in_minutes: Gets or sets the app consistent snapshot frequency - (in minutes). Required. - :vartype app_consistent_frequency_in_minutes: int - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "recovery_point_history_in_minutes": {"required": True}, - "crash_consistent_frequency_in_minutes": {"required": True}, - "app_consistent_frequency_in_minutes": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - } - - def __init__( - self, - *, - recovery_point_history_in_minutes: int, - crash_consistent_frequency_in_minutes: int, - app_consistent_frequency_in_minutes: int, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_history_in_minutes: Gets or sets the duration in minutes until which - the recovery points need to be - stored. Required. - :paramtype recovery_point_history_in_minutes: int - :keyword crash_consistent_frequency_in_minutes: Gets or sets the crash consistent snapshot - frequency (in minutes). Required. - :paramtype crash_consistent_frequency_in_minutes: int - :keyword app_consistent_frequency_in_minutes: Gets or sets the app consistent snapshot - frequency (in minutes). Required. - :paramtype app_consistent_frequency_in_minutes: int - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVToAzStackHCI" - self.recovery_point_history_in_minutes = recovery_point_history_in_minutes - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - - -class HyperVToAzStackHCIProtectedDiskProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """HyperVToAzStackHCI protected disk properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar storage_container_id: Gets or sets the ARM Id of the storage container. - :vartype storage_container_id: str - :ivar storage_container_local_path: Gets or sets the local path of the storage container. - :vartype storage_container_local_path: str - :ivar source_disk_id: Gets or sets the source disk Id. - :vartype source_disk_id: str - :ivar source_disk_name: Gets or sets the source disk Name. - :vartype source_disk_name: str - :ivar seed_disk_name: Gets or sets the seed disk name. - :vartype seed_disk_name: str - :ivar test_migrate_disk_name: Gets or sets the test failover clone disk. - :vartype test_migrate_disk_name: str - :ivar migrate_disk_name: Gets or sets the failover clone disk. - :vartype migrate_disk_name: str - :ivar is_os_disk: Gets or sets a value indicating whether the disk is the OS disk. - :vartype is_os_disk: bool - :ivar capacity_in_bytes: Gets or sets the disk capacity in bytes. - :vartype capacity_in_bytes: int - :ivar is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the - virtual hard - disk. - :vartype is_dynamic: bool - :ivar disk_type: Gets or sets the disk type. - :vartype disk_type: str - """ - - _validation = { - "storage_container_id": {"readonly": True}, - "storage_container_local_path": {"readonly": True}, - "source_disk_id": {"readonly": True}, - "source_disk_name": {"readonly": True}, - "seed_disk_name": {"readonly": True}, - "test_migrate_disk_name": {"readonly": True}, - "migrate_disk_name": {"readonly": True}, - "is_os_disk": {"readonly": True}, - "capacity_in_bytes": {"readonly": True}, - "is_dynamic": {"readonly": True}, - "disk_type": {"readonly": True}, - } - - _attribute_map = { - "storage_container_id": {"key": "storageContainerId", "type": "str"}, - "storage_container_local_path": {"key": "storageContainerLocalPath", "type": "str"}, - "source_disk_id": {"key": "sourceDiskId", "type": "str"}, - "source_disk_name": {"key": "sourceDiskName", "type": "str"}, - "seed_disk_name": {"key": "seedDiskName", "type": "str"}, - "test_migrate_disk_name": {"key": "testMigrateDiskName", "type": "str"}, - "migrate_disk_name": {"key": "migrateDiskName", "type": "str"}, - "is_os_disk": {"key": "isOsDisk", "type": "bool"}, - "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, - "is_dynamic": {"key": "isDynamic", "type": "bool"}, - "disk_type": {"key": "diskType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_container_id = None - self.storage_container_local_path = None - self.source_disk_id = None - self.source_disk_name = None - self.seed_disk_name = None - self.test_migrate_disk_name = None - self.migrate_disk_name = None - self.is_os_disk = None - self.capacity_in_bytes = None - self.is_dynamic = None - self.disk_type = None - - -class ProtectedItemModelCustomProperties(_serialization.Model): - """Protected item model custom properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HyperVToAzStackHCIProtectedItemModelCustomProperties, - VMwareToAzStackHCIProtectedItemModelCustomProperties - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "HyperVToAzStackHCI": "HyperVToAzStackHCIProtectedItemModelCustomProperties", - "VMwareToAzStackHCI": "VMwareToAzStackHCIProtectedItemModelCustomProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class HyperVToAzStackHCIProtectedItemModelCustomProperties( - ProtectedItemModelCustomProperties -): # pylint: disable=too-many-instance-attributes - """HyperV to AzStackHCI Protected item model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar active_location: Gets or sets the location of the protected item. Known values are: - "Primary" and "Recovery". - :vartype active_location: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemActiveLocation - :ivar target_hci_cluster_id: Gets or sets the Target HCI Cluster ARM Id. Required. - :vartype target_hci_cluster_id: str - :ivar target_arc_cluster_custom_location_id: Gets or sets the Target Arc Cluster Custom - Location ARM Id. Required. - :vartype target_arc_cluster_custom_location_id: str - :ivar target_az_stack_hci_cluster_name: Gets or sets the Target AzStackHCI cluster name. - :vartype target_az_stack_hci_cluster_name: str - :ivar fabric_discovery_machine_id: Gets or sets the ARM Id of the discovered machine. Required. - :vartype fabric_discovery_machine_id: str - :ivar disks_to_include: Gets or sets the list of disks to replicate. Required. - :vartype disks_to_include: - list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIDiskInput] - :ivar nics_to_include: Gets or sets the list of VM NIC to replicate. Required. - :vartype nics_to_include: - list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCINicInput] - :ivar source_vm_name: Gets or sets the source VM display name. - :vartype source_vm_name: str - :ivar source_cpu_cores: Gets or sets the source VM CPU cores. - :vartype source_cpu_cores: int - :ivar source_memory_in_mega_bytes: Gets or sets the source VM ram memory size in megabytes. - :vartype source_memory_in_mega_bytes: float - :ivar target_vm_name: Gets or sets the target VM display name. - :vartype target_vm_name: str - :ivar target_resource_group_id: Gets or sets the target resource group ARM Id. Required. - :vartype target_resource_group_id: str - :ivar storage_container_id: Gets or sets the target storage container ARM Id. Required. - :vartype storage_container_id: str - :ivar hyper_v_generation: Gets or sets the hypervisor generation of the virtual machine. - Required. - :vartype hyper_v_generation: str - :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - :vartype target_network_id: str - :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - :vartype test_network_id: str - :ivar target_cpu_cores: Gets or sets the target CPU cores. - :vartype target_cpu_cores: int - :ivar is_dynamic_ram: Gets or sets a value indicating whether memory is dynamical. - :vartype is_dynamic_ram: bool - :ivar dynamic_memory_config: Protected item dynamic memory config. - :vartype dynamic_memory_config: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemDynamicMemoryConfig - :ivar target_memory_in_mega_bytes: Gets or sets the target memory in mega-bytes. - :vartype target_memory_in_mega_bytes: int - :ivar run_as_account_id: Gets or sets the Run As account Id. Required. - :vartype run_as_account_id: str - :ivar source_dra_name: Gets or sets the source DRA name. Required. - :vartype source_dra_name: str - :ivar target_dra_name: Gets or sets the target DRA name. Required. - :vartype target_dra_name: str - :ivar source_appliance_name: Gets or sets the source appliance name. - :vartype source_appliance_name: str - :ivar target_appliance_name: Gets or sets the target appliance name. - :vartype target_appliance_name: str - :ivar os_type: Gets or sets the type of the OS. - :vartype os_type: str - :ivar os_name: Gets or sets the name of the OS. - :vartype os_name: str - :ivar firmware_type: Gets or sets the firmware type. - :vartype firmware_type: str - :ivar target_location: Gets or sets the target location. - :vartype target_location: str - :ivar custom_location_region: Gets or sets the location of Azure Arc HCI custom location - resource. Required. - :vartype custom_location_region: str - :ivar failover_recovery_point_id: Gets or sets the recovery point Id to which the VM was failed - over. - :vartype failover_recovery_point_id: str - :ivar last_recovery_point_received: Gets or sets the last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :ivar last_recovery_point_id: Gets or sets the last recovery point Id. - :vartype last_recovery_point_id: str - :ivar initial_replication_progress_percentage: Gets or sets the initial replication progress - percentage. This is calculated based on - total bytes processed for all disks in the source VM. - :vartype initial_replication_progress_percentage: int - :ivar resync_progress_percentage: Gets or sets the resync progress percentage. This is - calculated based on total bytes - processed for all disks in the source VM. - :vartype resync_progress_percentage: int - :ivar protected_disks: Gets or sets the list of protected disks. - :vartype protected_disks: - list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIProtectedDiskProperties] - :ivar protected_nics: Gets or sets the VM NIC details. - :vartype protected_nics: - list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIProtectedNicProperties] - :ivar target_vm_bios_id: Gets or sets the BIOS Id of the target AzStackHCI VM. - :vartype target_vm_bios_id: str - :ivar last_replication_update_time: Gets or sets the latest timestamp that replication status - is updated. - :vartype last_replication_update_time: ~datetime.datetime - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "active_location": {"readonly": True}, - "target_hci_cluster_id": {"required": True, "min_length": 1}, - "target_arc_cluster_custom_location_id": {"required": True, "min_length": 1}, - "target_az_stack_hci_cluster_name": {"readonly": True}, - "fabric_discovery_machine_id": {"required": True, "min_length": 1}, - "disks_to_include": {"required": True, "min_items": 1}, - "nics_to_include": {"required": True, "min_items": 1}, - "source_vm_name": {"readonly": True}, - "source_cpu_cores": {"readonly": True}, - "source_memory_in_mega_bytes": {"readonly": True}, - "target_resource_group_id": {"required": True, "min_length": 1}, - "storage_container_id": {"required": True, "min_length": 1}, - "hyper_v_generation": {"required": True, "min_length": 1}, - "run_as_account_id": {"required": True, "min_length": 1}, - "source_dra_name": {"required": True, "min_length": 1}, - "target_dra_name": {"required": True, "min_length": 1}, - "source_appliance_name": {"readonly": True}, - "target_appliance_name": {"readonly": True}, - "os_type": {"readonly": True}, - "os_name": {"readonly": True}, - "firmware_type": {"readonly": True}, - "target_location": {"readonly": True}, - "custom_location_region": {"required": True, "min_length": 1}, - "failover_recovery_point_id": {"readonly": True}, - "last_recovery_point_received": {"readonly": True}, - "last_recovery_point_id": {"readonly": True}, - "initial_replication_progress_percentage": {"readonly": True}, - "resync_progress_percentage": {"readonly": True}, - "protected_disks": {"readonly": True}, - "protected_nics": {"readonly": True}, - "target_vm_bios_id": {"readonly": True}, - "last_replication_update_time": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "active_location": {"key": "activeLocation", "type": "str"}, - "target_hci_cluster_id": {"key": "targetHciClusterId", "type": "str"}, - "target_arc_cluster_custom_location_id": {"key": "targetArcClusterCustomLocationId", "type": "str"}, - "target_az_stack_hci_cluster_name": {"key": "targetAzStackHciClusterName", "type": "str"}, - "fabric_discovery_machine_id": {"key": "fabricDiscoveryMachineId", "type": "str"}, - "disks_to_include": {"key": "disksToInclude", "type": "[HyperVToAzStackHCIDiskInput]"}, - "nics_to_include": {"key": "nicsToInclude", "type": "[HyperVToAzStackHCINicInput]"}, - "source_vm_name": {"key": "sourceVmName", "type": "str"}, - "source_cpu_cores": {"key": "sourceCpuCores", "type": "int"}, - "source_memory_in_mega_bytes": {"key": "sourceMemoryInMegaBytes", "type": "float"}, - "target_vm_name": {"key": "targetVmName", "type": "str"}, - "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, - "storage_container_id": {"key": "storageContainerId", "type": "str"}, - "hyper_v_generation": {"key": "hyperVGeneration", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "target_cpu_cores": {"key": "targetCpuCores", "type": "int"}, - "is_dynamic_ram": {"key": "isDynamicRam", "type": "bool"}, - "dynamic_memory_config": {"key": "dynamicMemoryConfig", "type": "ProtectedItemDynamicMemoryConfig"}, - "target_memory_in_mega_bytes": {"key": "targetMemoryInMegaBytes", "type": "int"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "source_dra_name": {"key": "sourceDraName", "type": "str"}, - "target_dra_name": {"key": "targetDraName", "type": "str"}, - "source_appliance_name": {"key": "sourceApplianceName", "type": "str"}, - "target_appliance_name": {"key": "targetApplianceName", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "os_name": {"key": "osName", "type": "str"}, - "firmware_type": {"key": "firmwareType", "type": "str"}, - "target_location": {"key": "targetLocation", "type": "str"}, - "custom_location_region": {"key": "customLocationRegion", "type": "str"}, - "failover_recovery_point_id": {"key": "failoverRecoveryPointId", "type": "str"}, - "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, - "last_recovery_point_id": {"key": "lastRecoveryPointId", "type": "str"}, - "initial_replication_progress_percentage": {"key": "initialReplicationProgressPercentage", "type": "int"}, - "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, - "protected_disks": {"key": "protectedDisks", "type": "[HyperVToAzStackHCIProtectedDiskProperties]"}, - "protected_nics": {"key": "protectedNics", "type": "[HyperVToAzStackHCIProtectedNicProperties]"}, - "target_vm_bios_id": {"key": "targetVmBiosId", "type": "str"}, - "last_replication_update_time": {"key": "lastReplicationUpdateTime", "type": "iso-8601"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - target_hci_cluster_id: str, - target_arc_cluster_custom_location_id: str, - fabric_discovery_machine_id: str, - disks_to_include: List["_models.HyperVToAzStackHCIDiskInput"], - nics_to_include: List["_models.HyperVToAzStackHCINicInput"], - target_resource_group_id: str, - storage_container_id: str, - hyper_v_generation: str, - run_as_account_id: str, - source_dra_name: str, - target_dra_name: str, - custom_location_region: str, - target_vm_name: Optional[str] = None, - target_network_id: Optional[str] = None, - test_network_id: Optional[str] = None, - target_cpu_cores: Optional[int] = None, - is_dynamic_ram: Optional[bool] = None, - dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = None, - target_memory_in_mega_bytes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_hci_cluster_id: Gets or sets the Target HCI Cluster ARM Id. Required. - :paramtype target_hci_cluster_id: str - :keyword target_arc_cluster_custom_location_id: Gets or sets the Target Arc Cluster Custom - Location ARM Id. Required. - :paramtype target_arc_cluster_custom_location_id: str - :keyword fabric_discovery_machine_id: Gets or sets the ARM Id of the discovered machine. - Required. - :paramtype fabric_discovery_machine_id: str - :keyword disks_to_include: Gets or sets the list of disks to replicate. Required. - :paramtype disks_to_include: - list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCIDiskInput] - :keyword nics_to_include: Gets or sets the list of VM NIC to replicate. Required. - :paramtype nics_to_include: - list[~azure.mgmt.recoveryservicesdatareplication.models.HyperVToAzStackHCINicInput] - :keyword target_vm_name: Gets or sets the target VM display name. - :paramtype target_vm_name: str - :keyword target_resource_group_id: Gets or sets the target resource group ARM Id. Required. - :paramtype target_resource_group_id: str - :keyword storage_container_id: Gets or sets the target storage container ARM Id. Required. - :paramtype storage_container_id: str - :keyword hyper_v_generation: Gets or sets the hypervisor generation of the virtual machine. - Required. - :paramtype hyper_v_generation: str - :keyword target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - :paramtype target_network_id: str - :keyword test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - :paramtype test_network_id: str - :keyword target_cpu_cores: Gets or sets the target CPU cores. - :paramtype target_cpu_cores: int - :keyword is_dynamic_ram: Gets or sets a value indicating whether memory is dynamical. - :paramtype is_dynamic_ram: bool - :keyword dynamic_memory_config: Protected item dynamic memory config. - :paramtype dynamic_memory_config: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemDynamicMemoryConfig - :keyword target_memory_in_mega_bytes: Gets or sets the target memory in mega-bytes. - :paramtype target_memory_in_mega_bytes: int - :keyword run_as_account_id: Gets or sets the Run As account Id. Required. - :paramtype run_as_account_id: str - :keyword source_dra_name: Gets or sets the source DRA name. Required. - :paramtype source_dra_name: str - :keyword target_dra_name: Gets or sets the target DRA name. Required. - :paramtype target_dra_name: str - :keyword custom_location_region: Gets or sets the location of Azure Arc HCI custom location - resource. Required. - :paramtype custom_location_region: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVToAzStackHCI" - self.active_location = None - self.target_hci_cluster_id = target_hci_cluster_id - self.target_arc_cluster_custom_location_id = target_arc_cluster_custom_location_id - self.target_az_stack_hci_cluster_name = None - self.fabric_discovery_machine_id = fabric_discovery_machine_id - self.disks_to_include = disks_to_include - self.nics_to_include = nics_to_include - self.source_vm_name = None - self.source_cpu_cores = None - self.source_memory_in_mega_bytes = None - self.target_vm_name = target_vm_name - self.target_resource_group_id = target_resource_group_id - self.storage_container_id = storage_container_id - self.hyper_v_generation = hyper_v_generation - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.target_cpu_cores = target_cpu_cores - self.is_dynamic_ram = is_dynamic_ram - self.dynamic_memory_config = dynamic_memory_config - self.target_memory_in_mega_bytes = target_memory_in_mega_bytes - self.run_as_account_id = run_as_account_id - self.source_dra_name = source_dra_name - self.target_dra_name = target_dra_name - self.source_appliance_name = None - self.target_appliance_name = None - self.os_type = None - self.os_name = None - self.firmware_type = None - self.target_location = None - self.custom_location_region = custom_location_region - self.failover_recovery_point_id = None - self.last_recovery_point_received = None - self.last_recovery_point_id = None - self.initial_replication_progress_percentage = None - self.resync_progress_percentage = None - self.protected_disks = None - self.protected_nics = None - self.target_vm_bios_id = None - self.last_replication_update_time = None - - -class HyperVToAzStackHCIProtectedNicProperties(_serialization.Model): - """HyperVToAzStackHCI NIC properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar nic_id: Gets or sets the NIC Id. - :vartype nic_id: str - :ivar mac_address: Gets or sets the NIC mac address. - :vartype mac_address: str - :ivar network_name: Gets or sets the network name. - :vartype network_name: str - :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - :vartype target_network_id: str - :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - :vartype test_network_id: str - :ivar selection_type_for_failover: Gets or sets the selection type of the NIC. Known values - are: "NotSelected", "SelectedByUser", "SelectedByDefault", and "SelectedByUserOverride". - :vartype selection_type_for_failover: str or - ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection - """ - - _validation = { - "nic_id": {"readonly": True}, - "mac_address": {"readonly": True}, - "network_name": {"readonly": True}, - "target_network_id": {"readonly": True}, - "test_network_id": {"readonly": True}, - "selection_type_for_failover": {"readonly": True}, - } - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "mac_address": {"key": "macAddress", "type": "str"}, - "network_name": {"key": "networkName", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "selection_type_for_failover": {"key": "selectionTypeForFailover", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.nic_id = None - self.mac_address = None - self.network_name = None - self.target_network_id = None - self.test_network_id = None - self.selection_type_for_failover = None - - -class RecoveryPointModelCustomProperties(_serialization.Model): - """Recovery point model custom properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HyperVToAzStackHCIRecoveryPointModelCustomProperties - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"HyperVToAzStackHCI": "HyperVToAzStackHCIRecoveryPointModelCustomProperties"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class HyperVToAzStackHCIRecoveryPointModelCustomProperties(RecoveryPointModelCustomProperties): - """HyperV to AzStackHCI recovery point model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar disk_ids: Gets or sets the list of the disk Ids. - :vartype disk_ids: list[str] - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "disk_ids": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "disk_ids": {"key": "diskIds", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVToAzStackHCI" - self.disk_ids = None - - -class ReplicationExtensionModelCustomProperties(_serialization.Model): - """Replication extension model custom properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HyperVToAzStackHCIReplicationExtensionModelCustomProperties, - VMwareToAzStackHCIReplicationExtensionModelCustomProperties - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "HyperVToAzStackHCI": "HyperVToAzStackHCIReplicationExtensionModelCustomProperties", - "VMwareToAzStackHCI": "VMwareToAzStackHCIReplicationExtensionModelCustomProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class HyperVToAzStackHCIReplicationExtensionModelCustomProperties( - ReplicationExtensionModelCustomProperties -): # pylint: disable=too-many-instance-attributes - """HyperV to AzStackHCI Replication extension model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar hyper_v_fabric_arm_id: Gets or sets the ARM Id of the source HyperV fabric. Required. - :vartype hyper_v_fabric_arm_id: str - :ivar hyper_v_site_id: Gets or sets the ARM Id of the HyperV site. - :vartype hyper_v_site_id: str - :ivar az_stack_hci_fabric_arm_id: Gets or sets the ARM Id of the target AzStackHCI fabric. - Required. - :vartype az_stack_hci_fabric_arm_id: str - :ivar az_stack_hci_site_id: Gets or sets the ARM Id of the AzStackHCI site. - :vartype az_stack_hci_site_id: str - :ivar storage_account_id: Gets or sets the storage account Id. - :vartype storage_account_id: str - :ivar storage_account_sas_secret_name: Gets or sets the Sas Secret of storage account. - :vartype storage_account_sas_secret_name: str - :ivar asr_service_uri: Gets or sets the Uri of ASR. - :vartype asr_service_uri: str - :ivar rcm_service_uri: Gets or sets the Uri of Rcm. - :vartype rcm_service_uri: str - :ivar gateway_service_uri: Gets or sets the Uri of Gateway. - :vartype gateway_service_uri: str - :ivar source_gateway_service_id: Gets or sets the gateway service Id of source. - :vartype source_gateway_service_id: str - :ivar target_gateway_service_id: Gets or sets the gateway service Id of target. - :vartype target_gateway_service_id: str - :ivar source_storage_container_name: Gets or sets the source storage container name. - :vartype source_storage_container_name: str - :ivar target_storage_container_name: Gets or sets the target storage container name. - :vartype target_storage_container_name: str - :ivar resource_location: Gets or sets the resource location. - :vartype resource_location: str - :ivar subscription_id: Gets or sets the subscription. - :vartype subscription_id: str - :ivar resource_group: Gets or sets the resource group. - :vartype resource_group: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "hyper_v_fabric_arm_id": {"required": True, "min_length": 1}, - "hyper_v_site_id": {"readonly": True}, - "az_stack_hci_fabric_arm_id": {"required": True, "min_length": 1}, - "az_stack_hci_site_id": {"readonly": True}, - "asr_service_uri": {"readonly": True}, - "rcm_service_uri": {"readonly": True}, - "gateway_service_uri": {"readonly": True}, - "source_gateway_service_id": {"readonly": True}, - "target_gateway_service_id": {"readonly": True}, - "source_storage_container_name": {"readonly": True}, - "target_storage_container_name": {"readonly": True}, - "resource_location": {"readonly": True}, - "subscription_id": {"readonly": True}, - "resource_group": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "hyper_v_fabric_arm_id": {"key": "hyperVFabricArmId", "type": "str"}, - "hyper_v_site_id": {"key": "hyperVSiteId", "type": "str"}, - "az_stack_hci_fabric_arm_id": {"key": "azStackHciFabricArmId", "type": "str"}, - "az_stack_hci_site_id": {"key": "azStackHciSiteId", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "storage_account_sas_secret_name": {"key": "storageAccountSasSecretName", "type": "str"}, - "asr_service_uri": {"key": "asrServiceUri", "type": "str"}, - "rcm_service_uri": {"key": "rcmServiceUri", "type": "str"}, - "gateway_service_uri": {"key": "gatewayServiceUri", "type": "str"}, - "source_gateway_service_id": {"key": "sourceGatewayServiceId", "type": "str"}, - "target_gateway_service_id": {"key": "targetGatewayServiceId", "type": "str"}, - "source_storage_container_name": {"key": "sourceStorageContainerName", "type": "str"}, - "target_storage_container_name": {"key": "targetStorageContainerName", "type": "str"}, - "resource_location": {"key": "resourceLocation", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "resource_group": {"key": "resourceGroup", "type": "str"}, - } - - def __init__( - self, - *, - hyper_v_fabric_arm_id: str, - az_stack_hci_fabric_arm_id: str, - storage_account_id: Optional[str] = None, - storage_account_sas_secret_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword hyper_v_fabric_arm_id: Gets or sets the ARM Id of the source HyperV fabric. Required. - :paramtype hyper_v_fabric_arm_id: str - :keyword az_stack_hci_fabric_arm_id: Gets or sets the ARM Id of the target AzStackHCI fabric. - Required. - :paramtype az_stack_hci_fabric_arm_id: str - :keyword storage_account_id: Gets or sets the storage account Id. - :paramtype storage_account_id: str - :keyword storage_account_sas_secret_name: Gets or sets the Sas Secret of storage account. - :paramtype storage_account_sas_secret_name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVToAzStackHCI" - self.hyper_v_fabric_arm_id = hyper_v_fabric_arm_id - self.hyper_v_site_id = None - self.az_stack_hci_fabric_arm_id = az_stack_hci_fabric_arm_id - self.az_stack_hci_site_id = None - self.storage_account_id = storage_account_id - self.storage_account_sas_secret_name = storage_account_sas_secret_name - self.asr_service_uri = None - self.rcm_service_uri = None - self.gateway_service_uri = None - self.source_gateway_service_id = None - self.target_gateway_service_id = None - self.source_storage_container_name = None - self.target_storage_container_name = None - self.resource_location = None - self.subscription_id = None - self.resource_group = None - - -class IdentityModel(_serialization.Model): - """Identity model. - - All required parameters must be populated in order to send to Azure. - - :ivar tenant_id: Gets or sets the tenant Id of the SPN with which Dra communicates to service. - Required. - :vartype tenant_id: str - :ivar application_id: Gets or sets the client/application Id of the SPN with which Dra - communicates to - service. Required. - :vartype application_id: str - :ivar object_id: Gets or sets the object Id of the SPN with which Dra communicates to service. - Required. - :vartype object_id: str - :ivar audience: Gets or sets the audience of the SPN with which Dra communicates to service. - Required. - :vartype audience: str - :ivar aad_authority: Gets or sets the authority of the SPN with which Dra communicates to - service. Required. - :vartype aad_authority: str - """ - - _validation = { - "tenant_id": {"required": True, "min_length": 1}, - "application_id": {"required": True, "min_length": 1}, - "object_id": {"required": True, "min_length": 1}, - "audience": {"required": True, "min_length": 1}, - "aad_authority": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "application_id": {"key": "applicationId", "type": "str"}, - "object_id": {"key": "objectId", "type": "str"}, - "audience": {"key": "audience", "type": "str"}, - "aad_authority": {"key": "aadAuthority", "type": "str"}, - } - - def __init__( - self, *, tenant_id: str, application_id: str, object_id: str, audience: str, aad_authority: str, **kwargs: Any - ) -> None: - """ - :keyword tenant_id: Gets or sets the tenant Id of the SPN with which Dra communicates to - service. Required. - :paramtype tenant_id: str - :keyword application_id: Gets or sets the client/application Id of the SPN with which Dra - communicates to - service. Required. - :paramtype application_id: str - :keyword object_id: Gets or sets the object Id of the SPN with which Dra communicates to - service. Required. - :paramtype object_id: str - :keyword audience: Gets or sets the audience of the SPN with which Dra communicates to service. - Required. - :paramtype audience: str - :keyword aad_authority: Gets or sets the authority of the SPN with which Dra communicates to - service. Required. - :paramtype aad_authority: str - """ - super().__init__(**kwargs) - self.tenant_id = tenant_id - self.application_id = application_id - self.object_id = object_id - self.audience = audience - self.aad_authority = aad_authority - - -class InnerHealthErrorModel(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Inner health error model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Gets or sets the error code. - :vartype code: str - :ivar health_category: Gets or sets the health category. - :vartype health_category: str - :ivar category: Gets or sets the error category. - :vartype category: str - :ivar severity: Gets or sets the error severity. - :vartype severity: str - :ivar source: Gets or sets the error source. - :vartype source: str - :ivar creation_time: Gets or sets the error creation time. - :vartype creation_time: ~datetime.datetime - :ivar is_customer_resolvable: Gets or sets a value indicating whether the error is customer - resolvable. - :vartype is_customer_resolvable: bool - :ivar summary: Gets or sets the error summary. - :vartype summary: str - :ivar message: Gets or sets the error message. - :vartype message: str - :ivar causes: Gets or sets possible causes of the error. - :vartype causes: str - :ivar recommendation: Gets or sets recommended action to resolve the error. - :vartype recommendation: str - """ - - _validation = { - "code": {"readonly": True}, - "health_category": {"readonly": True}, - "category": {"readonly": True}, - "severity": {"readonly": True}, - "source": {"readonly": True}, - "creation_time": {"readonly": True}, - "is_customer_resolvable": {"readonly": True}, - "summary": {"readonly": True}, - "message": {"readonly": True}, - "causes": {"readonly": True}, - "recommendation": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "health_category": {"key": "healthCategory", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "source": {"key": "source", "type": "str"}, - "creation_time": {"key": "creationTime", "type": "iso-8601"}, - "is_customer_resolvable": {"key": "isCustomerResolvable", "type": "bool"}, - "summary": {"key": "summary", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "causes": {"key": "causes", "type": "str"}, - "recommendation": {"key": "recommendation", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.health_category = None - self.category = None - self.severity = None - self.source = None - self.creation_time = None - self.is_customer_resolvable = None - self.summary = None - self.message = None - self.causes = None - self.recommendation = None - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.recoveryservicesdatareplication.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.recoveryservicesdatareplication.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.recoveryservicesdatareplication.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.recoveryservicesdatareplication.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationModel(_serialization.Model): - """Operation model. - - :ivar name: Gets or sets the name of the operation. - :vartype name: str - :ivar is_data_action: Gets or sets a value indicating whether the action is specific to data - plane or - control plane. - :vartype is_data_action: bool - :ivar origin: Gets or sets the executor of the operation. - :vartype origin: str - :ivar display: Operation model properties. - :vartype display: ~azure.mgmt.recoveryservicesdatareplication.models.OperationModelProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "origin": {"key": "origin", "type": "str"}, - "display": {"key": "display", "type": "OperationModelProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - origin: Optional[str] = None, - display: Optional["_models.OperationModelProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the operation. - :paramtype name: str - :keyword is_data_action: Gets or sets a value indicating whether the action is specific to data - plane or - control plane. - :paramtype is_data_action: bool - :keyword origin: Gets or sets the executor of the operation. - :paramtype origin: str - :keyword display: Operation model properties. - :paramtype display: ~azure.mgmt.recoveryservicesdatareplication.models.OperationModelProperties - """ - super().__init__(**kwargs) - self.name = name - self.is_data_action = is_data_action - self.origin = origin - self.display = display - - -class OperationModelCollection(_serialization.Model): - """Available operations of the service. - - :ivar value: Gets or sets the list of operations. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.OperationModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationModel"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of operations. - :paramtype value: list[~azure.mgmt.recoveryservicesdatareplication.models.OperationModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OperationModelProperties(_serialization.Model): - """Operation model properties. - - :ivar provider: Gets or sets the resource provider name. - :vartype provider: str - :ivar resource: Gets or sets resource name. - :vartype resource: str - :ivar operation: Gets or sets the operation. - :vartype operation: str - :ivar description: Gets or sets the description. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Gets or sets the resource provider name. - :paramtype provider: str - :keyword resource: Gets or sets resource name. - :paramtype resource: str - :keyword operation: Gets or sets the operation. - :paramtype operation: str - :keyword description: Gets or sets the description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationStatus(_serialization.Model): - """Defines the operation status. - - :ivar id: Gets or sets the Id. - :vartype id: str - :ivar name: Gets or sets the operation name. - :vartype name: str - :ivar status: Gets or sets the status of the operation. ARM expects the terminal status to be - one of - Succeeded/ Failed/ Canceled. All other values imply that the operation is still running. - :vartype status: str - :ivar start_time: Gets or sets the start time. - :vartype start_time: str - :ivar end_time: Gets or sets the end time. - :vartype end_time: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "start_time": {"key": "startTime", "type": "str"}, - "end_time": {"key": "endTime", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - status: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Gets or sets the Id. - :paramtype id: str - :keyword name: Gets or sets the operation name. - :paramtype name: str - :keyword status: Gets or sets the status of the operation. ARM expects the terminal status to - be one of - Succeeded/ Failed/ Canceled. All other values imply that the operation is still running. - :paramtype status: str - :keyword start_time: Gets or sets the start time. - :paramtype start_time: str - :keyword end_time: Gets or sets the end time. - :paramtype end_time: str - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.status = status - self.start_time = start_time - self.end_time = end_time - - -class PlannedFailoverModel(_serialization.Model): - """Planned failover model. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Planned failover model properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModelProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "PlannedFailoverModelProperties"}, - } - - def __init__(self, *, properties: "_models.PlannedFailoverModelProperties", **kwargs: Any) -> None: - """ - :keyword properties: Planned failover model properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModelProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class PlannedFailoverModelProperties(_serialization.Model): - """Planned failover model properties. - - All required parameters must be populated in order to send to Azure. - - :ivar custom_properties: Planned failover model custom properties. Required. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModelCustomProperties - """ - - _validation = { - "custom_properties": {"required": True}, - } - - _attribute_map = { - "custom_properties": {"key": "customProperties", "type": "PlannedFailoverModelCustomProperties"}, - } - - def __init__(self, *, custom_properties: "_models.PlannedFailoverModelCustomProperties", **kwargs: Any) -> None: - """ - :keyword custom_properties: Planned failover model custom properties. Required. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModelCustomProperties - """ - super().__init__(**kwargs) - self.custom_properties = custom_properties - - -class PolicyModel(_serialization.Model): - """Policy model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Policy model properties. Required. - :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModelSystemData - """ - - _validation = { - "properties": {"required": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "PolicyModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "PolicyModelSystemData"}, - } - - def __init__(self, *, properties: "_models.PolicyModelProperties", **kwargs: Any) -> None: - """ - :keyword properties: Policy model properties. Required. - :paramtype properties: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModelProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class PolicyModelCollection(_serialization.Model): - """Policy model collection. - - :ivar value: Gets or sets the list of policies. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PolicyModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.PolicyModel"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of policies. - :paramtype value: list[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PolicyModelProperties(_serialization.Model): - """Policy model properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar provisioning_state: Gets or sets the provisioning state of the policy. Known values are: - "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState - :ivar custom_properties: Policy model custom properties. Required. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModelCustomProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "custom_properties": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "custom_properties": {"key": "customProperties", "type": "PolicyModelCustomProperties"}, - } - - def __init__(self, *, custom_properties: "_models.PolicyModelCustomProperties", **kwargs: Any) -> None: - """ - :keyword custom_properties: Policy model custom properties. Required. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModelCustomProperties - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.custom_properties = custom_properties - - -class PolicyModelSystemData(SystemDataModel): - """PolicyModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class ProtectedItemDynamicMemoryConfig(_serialization.Model): - """Protected item dynamic memory config. - - All required parameters must be populated in order to send to Azure. - - :ivar maximum_memory_in_mega_bytes: Gets or sets maximum memory in MB. Required. - :vartype maximum_memory_in_mega_bytes: int - :ivar minimum_memory_in_mega_bytes: Gets or sets minimum memory in MB. Required. - :vartype minimum_memory_in_mega_bytes: int - :ivar target_memory_buffer_percentage: Gets or sets target memory buffer in %. Required. - :vartype target_memory_buffer_percentage: int - """ - - _validation = { - "maximum_memory_in_mega_bytes": {"required": True}, - "minimum_memory_in_mega_bytes": {"required": True}, - "target_memory_buffer_percentage": {"required": True}, - } - - _attribute_map = { - "maximum_memory_in_mega_bytes": {"key": "maximumMemoryInMegaBytes", "type": "int"}, - "minimum_memory_in_mega_bytes": {"key": "minimumMemoryInMegaBytes", "type": "int"}, - "target_memory_buffer_percentage": {"key": "targetMemoryBufferPercentage", "type": "int"}, - } - - def __init__( - self, - *, - maximum_memory_in_mega_bytes: int, - minimum_memory_in_mega_bytes: int, - target_memory_buffer_percentage: int, - **kwargs: Any - ) -> None: - """ - :keyword maximum_memory_in_mega_bytes: Gets or sets maximum memory in MB. Required. - :paramtype maximum_memory_in_mega_bytes: int - :keyword minimum_memory_in_mega_bytes: Gets or sets minimum memory in MB. Required. - :paramtype minimum_memory_in_mega_bytes: int - :keyword target_memory_buffer_percentage: Gets or sets target memory buffer in %. Required. - :paramtype target_memory_buffer_percentage: int - """ - super().__init__(**kwargs) - self.maximum_memory_in_mega_bytes = maximum_memory_in_mega_bytes - self.minimum_memory_in_mega_bytes = minimum_memory_in_mega_bytes - self.target_memory_buffer_percentage = target_memory_buffer_percentage - - -class ProtectedItemJobProperties(_serialization.Model): - """Protected item job properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar scenario_name: Gets or sets protection scenario name. - :vartype scenario_name: str - :ivar id: Gets or sets workflow Id. - :vartype id: str - :ivar name: Gets or sets workflow name. - :vartype name: str - :ivar display_name: Gets or sets the workflow friendly display name. - :vartype display_name: str - :ivar state: Gets or sets workflow state. - :vartype state: str - :ivar start_time: Gets or sets start time of the workflow. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets or sets end time of the workflow. - :vartype end_time: ~datetime.datetime - """ - - _validation = { - "scenario_name": {"readonly": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "display_name": {"readonly": True}, - "state": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - } - - _attribute_map = { - "scenario_name": {"key": "scenarioName", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.scenario_name = None - self.id = None - self.name = None - self.display_name = None - self.state = None - self.start_time = None - self.end_time = None - - -class ProtectedItemModel(_serialization.Model): - """Protected item model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Protected item model properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelSystemData - """ - - _validation = { - "properties": {"required": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "ProtectedItemModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "ProtectedItemModelSystemData"}, - } - - def __init__(self, *, properties: "_models.ProtectedItemModelProperties", **kwargs: Any) -> None: - """ - :keyword properties: Protected item model properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProtectedItemModelCollection(_serialization.Model): - """Protected item model collection. - - :ivar value: Gets or sets the list of protected items. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ProtectedItemModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ProtectedItemModel"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of protected items. - :paramtype value: list[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProtectedItemModelProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Protected item model properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar policy_name: Gets or sets the policy name. Required. - :vartype policy_name: str - :ivar replication_extension_name: Gets or sets the replication extension name. Required. - :vartype replication_extension_name: str - :ivar correlation_id: Gets or sets the protected item correlation Id. - :vartype correlation_id: str - :ivar provisioning_state: Gets or sets the provisioning state of the Dra. Known values are: - "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState - :ivar protection_state: Gets or sets the protection state. Known values are: - "UnprotectedStatesBegin", "EnablingProtection", "EnablingFailed", "DisablingProtection", - "MarkedForDeletion", "DisablingFailed", "UnprotectedStatesEnd", - "InitialReplicationStatesBegin", "InitialReplicationInProgress", - "InitialReplicationCompletedOnPrimary", "InitialReplicationCompletedOnRecovery", - "InitialReplicationFailed", "InitialReplicationStatesEnd", "ProtectedStatesBegin", "Protected", - "ProtectedStatesEnd", "PlannedFailoverTransitionStatesBegin", "PlannedFailoverInitiated", - "PlannedFailoverCompleting", "PlannedFailoverCompleted", "PlannedFailoverFailed", - "PlannedFailoverCompletionFailed", "PlannedFailoverTransitionStatesEnd", - "UnplannedFailoverTransitionStatesBegin", "UnplannedFailoverInitiated", - "UnplannedFailoverCompleting", "UnplannedFailoverCompleted", "UnplannedFailoverFailed", - "UnplannedFailoverCompletionFailed", "UnplannedFailoverTransitionStatesEnd", - "CommitFailoverStatesBegin", "CommitFailoverInProgressOnPrimary", - "CommitFailoverInProgressOnRecovery", "CommitFailoverCompleted", - "CommitFailoverFailedOnPrimary", "CommitFailoverFailedOnRecovery", "CommitFailoverStatesEnd", - "CancelFailoverStatesBegin", "CancelFailoverInProgressOnPrimary", - "CancelFailoverInProgressOnRecovery", "CancelFailoverFailedOnPrimary", - "CancelFailoverFailedOnRecovery", "CancelFailoverStatesEnd", "ChangeRecoveryPointStatesBegin", - "ChangeRecoveryPointInitiated", "ChangeRecoveryPointCompleted", "ChangeRecoveryPointFailed", - "ChangeRecoveryPointStatesEnd", "ReprotectStatesBegin", "ReprotectInitiated", - "ReprotectFailed", and "ReprotectStatesEnd". - :vartype protection_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectionState - :ivar protection_state_description: Gets or sets the protection state description. - :vartype protection_state_description: str - :ivar test_failover_state: Gets or sets the test failover state. Known values are: "None", - "TestFailoverInitiated", "TestFailoverCompleting", "TestFailoverCompleted", - "TestFailoverFailed", "TestFailoverCompletionFailed", "TestFailoverCleanupInitiated", - "TestFailoverCleanupCompleting", and "MarkedForDeletion". - :vartype test_failover_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.TestFailoverState - :ivar test_failover_state_description: Gets or sets the Test failover state description. - :vartype test_failover_state_description: str - :ivar resynchronization_state: Gets or sets the resynchronization state. Known values are: - "None", "ResynchronizationInitiated", "ResynchronizationCompleted", and - "ResynchronizationFailed". - :vartype resynchronization_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ResynchronizationState - :ivar fabric_object_id: Gets or sets the fabric object Id. - :vartype fabric_object_id: str - :ivar fabric_object_name: Gets or sets the fabric object name. - :vartype fabric_object_name: str - :ivar source_fabric_provider_id: Gets or sets the source fabric provider Id. - :vartype source_fabric_provider_id: str - :ivar target_fabric_provider_id: Gets or sets the target fabric provider Id. - :vartype target_fabric_provider_id: str - :ivar fabric_id: Gets or sets the fabric Id. - :vartype fabric_id: str - :ivar target_fabric_id: Gets or sets the target fabric Id. - :vartype target_fabric_id: str - :ivar dra_id: Gets or sets the DRA Id. - :vartype dra_id: str - :ivar target_dra_id: Gets or sets the target DRA Id. - :vartype target_dra_id: str - :ivar resync_required: Gets or sets a value indicating whether resynchronization is required or - not. - :vartype resync_required: bool - :ivar last_successful_planned_failover_time: Gets or sets the Last successful planned failover - time. - :vartype last_successful_planned_failover_time: ~datetime.datetime - :ivar last_successful_unplanned_failover_time: Gets or sets the Last successful unplanned - failover time. - :vartype last_successful_unplanned_failover_time: ~datetime.datetime - :ivar last_successful_test_failover_time: Gets or sets the Last successful test failover time. - :vartype last_successful_test_failover_time: ~datetime.datetime - :ivar current_job: - :vartype current_job: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelPropertiesCurrentJob - :ivar allowed_jobs: Gets or sets the allowed scenarios on the protected item. - :vartype allowed_jobs: list[str] - :ivar last_failed_enable_protection_job: - :vartype last_failed_enable_protection_job: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelPropertiesLastFailedEnableProtectionJob - :ivar last_failed_planned_failover_job: - :vartype last_failed_planned_failover_job: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob - :ivar last_test_failover_job: - :vartype last_test_failover_job: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelPropertiesLastTestFailoverJob - :ivar replication_health: Gets or sets protected item replication health. Known values are: - "Normal", "Warning", and "Critical". - :vartype replication_health: str or - ~azure.mgmt.recoveryservicesdatareplication.models.HealthStatus - :ivar health_errors: Gets or sets the list of health errors. - :vartype health_errors: - list[~azure.mgmt.recoveryservicesdatareplication.models.HealthErrorModel] - :ivar custom_properties: Protected item model custom properties. Required. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelCustomProperties - """ - - _validation = { - "policy_name": {"required": True, "min_length": 1}, - "replication_extension_name": {"required": True, "min_length": 1}, - "correlation_id": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "protection_state": {"readonly": True}, - "protection_state_description": {"readonly": True}, - "test_failover_state": {"readonly": True}, - "test_failover_state_description": {"readonly": True}, - "resynchronization_state": {"readonly": True}, - "fabric_object_id": {"readonly": True}, - "fabric_object_name": {"readonly": True}, - "source_fabric_provider_id": {"readonly": True}, - "target_fabric_provider_id": {"readonly": True}, - "fabric_id": {"readonly": True}, - "target_fabric_id": {"readonly": True}, - "dra_id": {"readonly": True}, - "target_dra_id": {"readonly": True}, - "resync_required": {"readonly": True}, - "last_successful_planned_failover_time": {"readonly": True}, - "last_successful_unplanned_failover_time": {"readonly": True}, - "last_successful_test_failover_time": {"readonly": True}, - "current_job": {"readonly": True}, - "allowed_jobs": {"readonly": True}, - "last_failed_enable_protection_job": {"readonly": True}, - "last_failed_planned_failover_job": {"readonly": True}, - "last_test_failover_job": {"readonly": True}, - "replication_health": {"readonly": True}, - "health_errors": {"readonly": True}, - "custom_properties": {"required": True}, - } - - _attribute_map = { - "policy_name": {"key": "policyName", "type": "str"}, - "replication_extension_name": {"key": "replicationExtensionName", "type": "str"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "protection_state": {"key": "protectionState", "type": "str"}, - "protection_state_description": {"key": "protectionStateDescription", "type": "str"}, - "test_failover_state": {"key": "testFailoverState", "type": "str"}, - "test_failover_state_description": {"key": "testFailoverStateDescription", "type": "str"}, - "resynchronization_state": {"key": "resynchronizationState", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "fabric_object_name": {"key": "fabricObjectName", "type": "str"}, - "source_fabric_provider_id": {"key": "sourceFabricProviderId", "type": "str"}, - "target_fabric_provider_id": {"key": "targetFabricProviderId", "type": "str"}, - "fabric_id": {"key": "fabricId", "type": "str"}, - "target_fabric_id": {"key": "targetFabricId", "type": "str"}, - "dra_id": {"key": "draId", "type": "str"}, - "target_dra_id": {"key": "targetDraId", "type": "str"}, - "resync_required": {"key": "resyncRequired", "type": "bool"}, - "last_successful_planned_failover_time": {"key": "lastSuccessfulPlannedFailoverTime", "type": "iso-8601"}, - "last_successful_unplanned_failover_time": {"key": "lastSuccessfulUnplannedFailoverTime", "type": "iso-8601"}, - "last_successful_test_failover_time": {"key": "lastSuccessfulTestFailoverTime", "type": "iso-8601"}, - "current_job": {"key": "currentJob", "type": "ProtectedItemModelPropertiesCurrentJob"}, - "allowed_jobs": {"key": "allowedJobs", "type": "[str]"}, - "last_failed_enable_protection_job": { - "key": "lastFailedEnableProtectionJob", - "type": "ProtectedItemModelPropertiesLastFailedEnableProtectionJob", - }, - "last_failed_planned_failover_job": { - "key": "lastFailedPlannedFailoverJob", - "type": "ProtectedItemModelPropertiesLastFailedPlannedFailoverJob", - }, - "last_test_failover_job": { - "key": "lastTestFailoverJob", - "type": "ProtectedItemModelPropertiesLastTestFailoverJob", - }, - "replication_health": {"key": "replicationHealth", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthErrorModel]"}, - "custom_properties": {"key": "customProperties", "type": "ProtectedItemModelCustomProperties"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - policy_name: str, - replication_extension_name: str, - custom_properties: "_models.ProtectedItemModelCustomProperties", - **kwargs: Any - ) -> None: - """ - :keyword policy_name: Gets or sets the policy name. Required. - :paramtype policy_name: str - :keyword replication_extension_name: Gets or sets the replication extension name. Required. - :paramtype replication_extension_name: str - :keyword custom_properties: Protected item model custom properties. Required. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelCustomProperties - """ - super().__init__(**kwargs) - self.policy_name = policy_name - self.replication_extension_name = replication_extension_name - self.correlation_id = None - self.provisioning_state = None - self.protection_state = None - self.protection_state_description = None - self.test_failover_state = None - self.test_failover_state_description = None - self.resynchronization_state = None - self.fabric_object_id = None - self.fabric_object_name = None - self.source_fabric_provider_id = None - self.target_fabric_provider_id = None - self.fabric_id = None - self.target_fabric_id = None - self.dra_id = None - self.target_dra_id = None - self.resync_required = None - self.last_successful_planned_failover_time = None - self.last_successful_unplanned_failover_time = None - self.last_successful_test_failover_time = None - self.current_job = None - self.allowed_jobs = None - self.last_failed_enable_protection_job = None - self.last_failed_planned_failover_job = None - self.last_test_failover_job = None - self.replication_health = None - self.health_errors = None - self.custom_properties = custom_properties - - -class ProtectedItemModelPropertiesCurrentJob(ProtectedItemJobProperties): - """ProtectedItemModelPropertiesCurrentJob. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar scenario_name: Gets or sets protection scenario name. - :vartype scenario_name: str - :ivar id: Gets or sets workflow Id. - :vartype id: str - :ivar name: Gets or sets workflow name. - :vartype name: str - :ivar display_name: Gets or sets the workflow friendly display name. - :vartype display_name: str - :ivar state: Gets or sets workflow state. - :vartype state: str - :ivar start_time: Gets or sets start time of the workflow. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets or sets end time of the workflow. - :vartype end_time: ~datetime.datetime - """ - - _validation = { - "scenario_name": {"readonly": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "display_name": {"readonly": True}, - "state": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - } - - _attribute_map = { - "scenario_name": {"key": "scenarioName", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - - -class ProtectedItemModelPropertiesLastFailedEnableProtectionJob(ProtectedItemJobProperties): - """ProtectedItemModelPropertiesLastFailedEnableProtectionJob. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar scenario_name: Gets or sets protection scenario name. - :vartype scenario_name: str - :ivar id: Gets or sets workflow Id. - :vartype id: str - :ivar name: Gets or sets workflow name. - :vartype name: str - :ivar display_name: Gets or sets the workflow friendly display name. - :vartype display_name: str - :ivar state: Gets or sets workflow state. - :vartype state: str - :ivar start_time: Gets or sets start time of the workflow. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets or sets end time of the workflow. - :vartype end_time: ~datetime.datetime - """ - - _validation = { - "scenario_name": {"readonly": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "display_name": {"readonly": True}, - "state": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - } - - _attribute_map = { - "scenario_name": {"key": "scenarioName", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - - -class ProtectedItemModelPropertiesLastFailedPlannedFailoverJob(ProtectedItemJobProperties): - """ProtectedItemModelPropertiesLastFailedPlannedFailoverJob. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar scenario_name: Gets or sets protection scenario name. - :vartype scenario_name: str - :ivar id: Gets or sets workflow Id. - :vartype id: str - :ivar name: Gets or sets workflow name. - :vartype name: str - :ivar display_name: Gets or sets the workflow friendly display name. - :vartype display_name: str - :ivar state: Gets or sets workflow state. - :vartype state: str - :ivar start_time: Gets or sets start time of the workflow. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets or sets end time of the workflow. - :vartype end_time: ~datetime.datetime - """ - - _validation = { - "scenario_name": {"readonly": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "display_name": {"readonly": True}, - "state": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - } - - _attribute_map = { - "scenario_name": {"key": "scenarioName", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - - -class ProtectedItemModelPropertiesLastTestFailoverJob(ProtectedItemJobProperties): - """ProtectedItemModelPropertiesLastTestFailoverJob. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar scenario_name: Gets or sets protection scenario name. - :vartype scenario_name: str - :ivar id: Gets or sets workflow Id. - :vartype id: str - :ivar name: Gets or sets workflow name. - :vartype name: str - :ivar display_name: Gets or sets the workflow friendly display name. - :vartype display_name: str - :ivar state: Gets or sets workflow state. - :vartype state: str - :ivar start_time: Gets or sets start time of the workflow. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets or sets end time of the workflow. - :vartype end_time: ~datetime.datetime - """ - - _validation = { - "scenario_name": {"readonly": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "display_name": {"readonly": True}, - "state": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - } - - _attribute_map = { - "scenario_name": {"key": "scenarioName", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - - -class ProtectedItemModelSystemData(SystemDataModel): - """ProtectedItemModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class RecoveryPointModel(_serialization.Model): - """Recovery point model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Recovery point model properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: - ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModelSystemData - """ - - _validation = { - "properties": {"required": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "RecoveryPointModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "RecoveryPointModelSystemData"}, - } - - def __init__(self, *, properties: "_models.RecoveryPointModelProperties", **kwargs: Any) -> None: - """ - :keyword properties: Recovery point model properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModelProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class RecoveryPointModelCollection(_serialization.Model): - """Recovery point model collection. - - :ivar value: Gets or sets the list of recovery points. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RecoveryPointModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.RecoveryPointModel"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of recovery points. - :paramtype value: list[~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RecoveryPointModelProperties(_serialization.Model): - """Recovery point model properties. - - All required parameters must be populated in order to send to Azure. - - :ivar recovery_point_time: Gets or sets the recovery point time. Required. - :vartype recovery_point_time: ~datetime.datetime - :ivar recovery_point_type: Gets or sets the recovery point type. Required. Known values are: - "ApplicationConsistent" and "CrashConsistent". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointType - :ivar custom_properties: Recovery point model custom properties. Required. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModelCustomProperties - """ - - _validation = { - "recovery_point_time": {"required": True}, - "recovery_point_type": {"required": True}, - "custom_properties": {"required": True}, - } - - _attribute_map = { - "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "custom_properties": {"key": "customProperties", "type": "RecoveryPointModelCustomProperties"}, - } - - def __init__( - self, - *, - recovery_point_time: datetime.datetime, - recovery_point_type: Union[str, "_models.RecoveryPointType"], - custom_properties: "_models.RecoveryPointModelCustomProperties", - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_time: Gets or sets the recovery point time. Required. - :paramtype recovery_point_time: ~datetime.datetime - :keyword recovery_point_type: Gets or sets the recovery point type. Required. Known values are: - "ApplicationConsistent" and "CrashConsistent". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointType - :keyword custom_properties: Recovery point model custom properties. Required. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModelCustomProperties - """ - super().__init__(**kwargs) - self.recovery_point_time = recovery_point_time - self.recovery_point_type = recovery_point_type - self.custom_properties = custom_properties - - -class RecoveryPointModelSystemData(SystemDataModel): - """RecoveryPointModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class ReplicationExtensionModel(_serialization.Model): - """Replication extension model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Replication extension model properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: - ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModelSystemData - """ - - _validation = { - "properties": {"required": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "ReplicationExtensionModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "ReplicationExtensionModelSystemData"}, - } - - def __init__(self, *, properties: "_models.ReplicationExtensionModelProperties", **kwargs: Any) -> None: - """ - :keyword properties: Replication extension model properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModelProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ReplicationExtensionModelCollection(_serialization.Model): - """Replication extension model collection. - - :ivar value: Gets or sets the list of replication extensions. - :vartype value: - list[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ReplicationExtensionModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ReplicationExtensionModel"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of replication extensions. - :paramtype value: - list[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ReplicationExtensionModelProperties(_serialization.Model): - """Replication extension model properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar provisioning_state: Gets or sets the provisioning state of the replication extension. - Known values are: "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and - "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState - :ivar custom_properties: Replication extension model custom properties. Required. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModelCustomProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "custom_properties": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "custom_properties": {"key": "customProperties", "type": "ReplicationExtensionModelCustomProperties"}, - } - - def __init__( - self, *, custom_properties: "_models.ReplicationExtensionModelCustomProperties", **kwargs: Any - ) -> None: - """ - :keyword custom_properties: Replication extension model custom properties. Required. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModelCustomProperties - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.custom_properties = custom_properties - - -class ReplicationExtensionModelSystemData(SystemDataModel): - """ReplicationExtensionModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class StorageContainerProperties(_serialization.Model): - """Storage container properties. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Gets or sets the Name. Required. - :vartype name: str - :ivar cluster_shared_volume_path: Gets or sets the ClusterSharedVolumePath. Required. - :vartype cluster_shared_volume_path: str - """ - - _validation = { - "name": {"required": True, "min_length": 1}, - "cluster_shared_volume_path": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "cluster_shared_volume_path": {"key": "clusterSharedVolumePath", "type": "str"}, - } - - def __init__(self, *, name: str, cluster_shared_volume_path: str, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the Name. Required. - :paramtype name: str - :keyword cluster_shared_volume_path: Gets or sets the ClusterSharedVolumePath. Required. - :paramtype cluster_shared_volume_path: str - """ - super().__init__(**kwargs) - self.name = name - self.cluster_shared_volume_path = cluster_shared_volume_path - - -class TaskModel(_serialization.Model): - """Task model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar task_name: Gets or sets the task name. - :vartype task_name: str - :ivar state: Gets or sets the task state. Known values are: "Pending", "Started", "Succeeded", - "Failed", "Cancelled", and "Skipped". - :vartype state: str or ~azure.mgmt.recoveryservicesdatareplication.models.TaskState - :ivar start_time: Gets or sets the start time. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets or sets the end time. - :vartype end_time: ~datetime.datetime - :ivar custom_properties: Task model custom properties. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.TaskModelCustomProperties - :ivar children_workflows: Gets or sets the list of children workflow models. - :vartype children_workflows: - list[~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModel] - """ - - _validation = { - "task_name": {"readonly": True}, - "state": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - } - - _attribute_map = { - "task_name": {"key": "taskName", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "custom_properties": {"key": "customProperties", "type": "TaskModelCustomProperties"}, - "children_workflows": {"key": "childrenWorkflows", "type": "[WorkflowModel]"}, - } - - def __init__( - self, - *, - custom_properties: Optional["_models.TaskModelCustomProperties"] = None, - children_workflows: Optional[List["_models.WorkflowModel"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_properties: Task model custom properties. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.TaskModelCustomProperties - :keyword children_workflows: Gets or sets the list of children workflow models. - :paramtype children_workflows: - list[~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModel] - """ - super().__init__(**kwargs) - self.task_name = None - self.state = None - self.start_time = None - self.end_time = None - self.custom_properties = custom_properties - self.children_workflows = children_workflows - - -class TaskModelCustomProperties(_serialization.Model): - """Task model custom properties. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, *, instance_type: str, **kwargs: Any) -> None: - """ - :keyword instance_type: Gets or sets the instance type. Required. - :paramtype instance_type: str - """ - super().__init__(**kwargs) - self.instance_type = instance_type - - -class TestFailoverCleanupWorkflowModelCustomProperties(WorkflowModelCustomProperties): - """Test failover cleanup workflow model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar affected_object_details: Gets or sets any custom properties of the affected object. - :vartype affected_object_details: dict[str, str] - :ivar comments: Gets or sets the test failover cleanup comments. - :vartype comments: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "affected_object_details": {"readonly": True}, - "comments": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "comments": {"key": "comments", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "TestFailoverCleanupWorkflowDetails" - self.comments = None - - -class TestFailoverWorkflowModelCustomProperties(WorkflowModelCustomProperties): - """Test failover workflow model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar affected_object_details: Gets or sets any custom properties of the affected object. - :vartype affected_object_details: dict[str, str] - :ivar protected_item_details: Gets or sets the test VM details. - :vartype protected_item_details: - list[~azure.mgmt.recoveryservicesdatareplication.models.FailoverProtectedItemProperties] - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "affected_object_details": {"readonly": True}, - "protected_item_details": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "protected_item_details": {"key": "protectedItemDetails", "type": "[FailoverProtectedItemProperties]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "TestFailoverWorkflowDetails" - self.protected_item_details = None - - -class VaultModel(_serialization.Model): - """Vault model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar location: Gets or sets the location of the vault. Required. - :vartype location: str - :ivar tags: Gets or sets the resource tags. - :vartype tags: dict[str, str] - :ivar properties: Vault properties. - :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelSystemData - """ - - _validation = { - "location": {"required": True, "min_length": 1}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "VaultModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "VaultModelSystemData"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.VaultModelProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Gets or sets the location of the vault. Required. - :paramtype location: str - :keyword tags: Gets or sets the resource tags. - :paramtype tags: dict[str, str] - :keyword properties: Vault properties. - :paramtype properties: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelProperties - """ - super().__init__(**kwargs) - self.location = location - self.tags = tags - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class VaultModelCollection(_serialization.Model): - """Vault model collection. - - :ivar value: Gets or sets the list of vaults. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VaultModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.VaultModel"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of vaults. - :paramtype value: list[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VaultModelProperties(_serialization.Model): - """Vault properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Gets or sets the provisioning state of the vault. Known values are: - "Canceled", "Creating", "Deleting", "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ProvisioningState - :ivar service_resource_id: Gets or sets the service resource Id. - :vartype service_resource_id: str - :ivar vault_type: Gets or sets the type of vault. Known values are: "DisasterRecovery" and - "Migrate". - :vartype vault_type: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationVaultType - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "service_resource_id": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "service_resource_id": {"key": "serviceResourceId", "type": "str"}, - "vault_type": {"key": "vaultType", "type": "str"}, - } - - def __init__( - self, *, vault_type: Optional[Union[str, "_models.ReplicationVaultType"]] = None, **kwargs: Any - ) -> None: - """ - :keyword vault_type: Gets or sets the type of vault. Known values are: "DisasterRecovery" and - "Migrate". - :paramtype vault_type: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationVaultType - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.service_resource_id = None - self.vault_type = vault_type - - -class VaultModelSystemData(SystemDataModel): - """VaultModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class VaultModelUpdate(_serialization.Model): - """Vault model for update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: Gets or sets the resource tags. - :vartype tags: dict[str, str] - :ivar properties: Vault properties. - :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: - ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdateSystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "VaultModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "VaultModelUpdateSystemData"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.VaultModelProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Gets or sets the resource tags. - :paramtype tags: dict[str, str] - :keyword properties: Vault properties. - :paramtype properties: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class VaultModelUpdateSystemData(SystemDataModel): - """VaultModelUpdateSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) - - -class VMwareDraModelCustomProperties(DraModelCustomProperties): - """VMware DRA model custom properties. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar bios_id: Gets or sets the BIOS Id of the DRA machine. Required. - :vartype bios_id: str - :ivar mars_authentication_identity: Identity model. Required. - :vartype mars_authentication_identity: - ~azure.mgmt.recoveryservicesdatareplication.models.IdentityModel - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "bios_id": {"required": True, "min_length": 1}, - "mars_authentication_identity": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "mars_authentication_identity": {"key": "marsAuthenticationIdentity", "type": "IdentityModel"}, - } - - def __init__(self, *, bios_id: str, mars_authentication_identity: "_models.IdentityModel", **kwargs: Any) -> None: - """ - :keyword bios_id: Gets or sets the BIOS Id of the DRA machine. Required. - :paramtype bios_id: str - :keyword mars_authentication_identity: Identity model. Required. - :paramtype mars_authentication_identity: - ~azure.mgmt.recoveryservicesdatareplication.models.IdentityModel - """ - super().__init__(**kwargs) - self.instance_type: str = "VMware" - self.bios_id = bios_id - self.mars_authentication_identity = mars_authentication_identity - - -class VMwareMigrateFabricModelCustomProperties(FabricModelCustomProperties): - """VMware migrate fabric model custom properties. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar vmware_site_id: Gets or sets the ARM Id of the VMware site. Required. - :vartype vmware_site_id: str - :ivar migration_solution_id: Gets or sets the ARM Id of the migration solution. Required. - :vartype migration_solution_id: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "vmware_site_id": {"required": True, "min_length": 1}, - "migration_solution_id": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, - "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, - } - - def __init__(self, *, vmware_site_id: str, migration_solution_id: str, **kwargs: Any) -> None: - """ - :keyword vmware_site_id: Gets or sets the ARM Id of the VMware site. Required. - :paramtype vmware_site_id: str - :keyword migration_solution_id: Gets or sets the ARM Id of the migration solution. Required. - :paramtype migration_solution_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareMigrate" - self.vmware_site_id = vmware_site_id - self.migration_solution_id = migration_solution_id - - -class VMwareToAzStackHCIDiskInput(_serialization.Model): - """VMwareToAzStack disk input. - - All required parameters must be populated in order to send to Azure. - - :ivar disk_id: Gets or sets the disk Id. Required. - :vartype disk_id: str - :ivar storage_container_id: Gets or sets the target storage account ARM Id. - :vartype storage_container_id: str - :ivar is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the - virtual hard - disk. - :vartype is_dynamic: bool - :ivar disk_size_gb: Gets or sets the disk size in GB. Required. - :vartype disk_size_gb: int - :ivar disk_file_format: Gets or sets the type of the virtual hard disk, vhd or vhdx. Required. - :vartype disk_file_format: str - :ivar is_os_disk: Gets or sets a value indicating whether disk is os disk. Required. - :vartype is_os_disk: bool - """ - - _validation = { - "disk_id": {"required": True, "min_length": 1}, - "disk_size_gb": {"required": True}, - "disk_file_format": {"required": True, "min_length": 1}, - "is_os_disk": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "storage_container_id": {"key": "storageContainerId", "type": "str"}, - "is_dynamic": {"key": "isDynamic", "type": "bool"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "disk_file_format": {"key": "diskFileFormat", "type": "str"}, - "is_os_disk": {"key": "isOsDisk", "type": "bool"}, - } - - def __init__( - self, - *, - disk_id: str, - disk_size_gb: int, - disk_file_format: str, - is_os_disk: bool, - storage_container_id: Optional[str] = None, - is_dynamic: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: Gets or sets the disk Id. Required. - :paramtype disk_id: str - :keyword storage_container_id: Gets or sets the target storage account ARM Id. - :paramtype storage_container_id: str - :keyword is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the - virtual hard - disk. - :paramtype is_dynamic: bool - :keyword disk_size_gb: Gets or sets the disk size in GB. Required. - :paramtype disk_size_gb: int - :keyword disk_file_format: Gets or sets the type of the virtual hard disk, vhd or vhdx. - Required. - :paramtype disk_file_format: str - :keyword is_os_disk: Gets or sets a value indicating whether disk is os disk. Required. - :paramtype is_os_disk: bool - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.storage_container_id = storage_container_id - self.is_dynamic = is_dynamic - self.disk_size_gb = disk_size_gb - self.disk_file_format = disk_file_format - self.is_os_disk = is_os_disk - - -class VMwareToAzStackHCINicInput(_serialization.Model): - """VMwareToAzStackHCI NIC properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar nic_id: Gets or sets the NIC Id. Required. - :vartype nic_id: str - :ivar label: Gets or sets the NIC label. Required. - :vartype label: str - :ivar network_name: Gets or sets the network name. - :vartype network_name: str - :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - Required. - :vartype target_network_id: str - :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - Required. - :vartype test_network_id: str - :ivar selection_type_for_failover: Gets or sets the selection type of the NIC. Required. Known - values are: "NotSelected", "SelectedByUser", "SelectedByDefault", and "SelectedByUserOverride". - :vartype selection_type_for_failover: str or - ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection - """ - - _validation = { - "nic_id": {"required": True, "min_length": 1}, - "label": {"required": True, "min_length": 1}, - "network_name": {"readonly": True}, - "target_network_id": {"required": True, "min_length": 1}, - "test_network_id": {"required": True, "min_length": 1}, - "selection_type_for_failover": {"required": True}, - } - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "label": {"key": "label", "type": "str"}, - "network_name": {"key": "networkName", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "selection_type_for_failover": {"key": "selectionTypeForFailover", "type": "str"}, - } - - def __init__( - self, - *, - nic_id: str, - label: str, - target_network_id: str, - test_network_id: str, - selection_type_for_failover: Union[str, "_models.VMNicSelection"], - **kwargs: Any - ) -> None: - """ - :keyword nic_id: Gets or sets the NIC Id. Required. - :paramtype nic_id: str - :keyword label: Gets or sets the NIC label. Required. - :paramtype label: str - :keyword target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - Required. - :paramtype target_network_id: str - :keyword test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - Required. - :paramtype test_network_id: str - :keyword selection_type_for_failover: Gets or sets the selection type of the NIC. Required. - Known values are: "NotSelected", "SelectedByUser", "SelectedByDefault", and - "SelectedByUserOverride". - :paramtype selection_type_for_failover: str or - ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection - """ - super().__init__(**kwargs) - self.nic_id = nic_id - self.label = label - self.network_name = None - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.selection_type_for_failover = selection_type_for_failover - - -class VMwareToAzStackHCIPlannedFailoverModelCustomProperties(PlannedFailoverModelCustomProperties): - """VMware to AzStackHCI planned failover model custom properties. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar shutdown_source_vm: Gets or sets a value indicating whether VM needs to be shut down. - Required. - :vartype shutdown_source_vm: bool - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "shutdown_source_vm": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "shutdown_source_vm": {"key": "shutdownSourceVM", "type": "bool"}, - } - - def __init__(self, *, shutdown_source_vm: bool, **kwargs: Any) -> None: - """ - :keyword shutdown_source_vm: Gets or sets a value indicating whether VM needs to be shut down. - Required. - :paramtype shutdown_source_vm: bool - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareToAzStackHCI" - self.shutdown_source_vm = shutdown_source_vm - - -class VMwareToAzStackHCIPolicyModelCustomProperties(PolicyModelCustomProperties): - """VMware To AzStackHCI Policy model custom properties. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar recovery_point_history_in_minutes: Gets or sets the duration in minutes until which the - recovery points need to be - stored. Required. - :vartype recovery_point_history_in_minutes: int - :ivar crash_consistent_frequency_in_minutes: Gets or sets the crash consistent snapshot - frequency (in minutes). Required. - :vartype crash_consistent_frequency_in_minutes: int - :ivar app_consistent_frequency_in_minutes: Gets or sets the app consistent snapshot frequency - (in minutes). Required. - :vartype app_consistent_frequency_in_minutes: int - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "recovery_point_history_in_minutes": {"required": True}, - "crash_consistent_frequency_in_minutes": {"required": True}, - "app_consistent_frequency_in_minutes": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - } - - def __init__( - self, - *, - recovery_point_history_in_minutes: int, - crash_consistent_frequency_in_minutes: int, - app_consistent_frequency_in_minutes: int, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_history_in_minutes: Gets or sets the duration in minutes until which - the recovery points need to be - stored. Required. - :paramtype recovery_point_history_in_minutes: int - :keyword crash_consistent_frequency_in_minutes: Gets or sets the crash consistent snapshot - frequency (in minutes). Required. - :paramtype crash_consistent_frequency_in_minutes: int - :keyword app_consistent_frequency_in_minutes: Gets or sets the app consistent snapshot - frequency (in minutes). Required. - :paramtype app_consistent_frequency_in_minutes: int - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareToAzStackHCI" - self.recovery_point_history_in_minutes = recovery_point_history_in_minutes - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - - -class VMwareToAzStackHCIProtectedDiskProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """VMwareToAzStackHCI protected disk properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar storage_container_id: Gets or sets the ARM Id of the storage container. - :vartype storage_container_id: str - :ivar storage_container_local_path: Gets or sets the local path of the storage container. - :vartype storage_container_local_path: str - :ivar source_disk_id: Gets or sets the source disk Id. - :vartype source_disk_id: str - :ivar source_disk_name: Gets or sets the source disk Name. - :vartype source_disk_name: str - :ivar seed_disk_name: Gets or sets the seed disk name. - :vartype seed_disk_name: str - :ivar test_migrate_disk_name: Gets or sets the test failover clone disk. - :vartype test_migrate_disk_name: str - :ivar migrate_disk_name: Gets or sets the failover clone disk. - :vartype migrate_disk_name: str - :ivar is_os_disk: Gets or sets a value indicating whether the disk is the OS disk. - :vartype is_os_disk: bool - :ivar capacity_in_bytes: Gets or sets the disk capacity in bytes. - :vartype capacity_in_bytes: int - :ivar is_dynamic: Gets or sets a value indicating whether dynamic sizing is enabled on the - virtual hard - disk. - :vartype is_dynamic: bool - :ivar disk_type: Gets or sets the disk type. - :vartype disk_type: str - """ - - _validation = { - "storage_container_id": {"readonly": True}, - "storage_container_local_path": {"readonly": True}, - "source_disk_id": {"readonly": True}, - "source_disk_name": {"readonly": True}, - "seed_disk_name": {"readonly": True}, - "test_migrate_disk_name": {"readonly": True}, - "migrate_disk_name": {"readonly": True}, - "is_os_disk": {"readonly": True}, - "capacity_in_bytes": {"readonly": True}, - "is_dynamic": {"readonly": True}, - "disk_type": {"readonly": True}, - } - - _attribute_map = { - "storage_container_id": {"key": "storageContainerId", "type": "str"}, - "storage_container_local_path": {"key": "storageContainerLocalPath", "type": "str"}, - "source_disk_id": {"key": "sourceDiskId", "type": "str"}, - "source_disk_name": {"key": "sourceDiskName", "type": "str"}, - "seed_disk_name": {"key": "seedDiskName", "type": "str"}, - "test_migrate_disk_name": {"key": "testMigrateDiskName", "type": "str"}, - "migrate_disk_name": {"key": "migrateDiskName", "type": "str"}, - "is_os_disk": {"key": "isOsDisk", "type": "bool"}, - "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, - "is_dynamic": {"key": "isDynamic", "type": "bool"}, - "disk_type": {"key": "diskType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_container_id = None - self.storage_container_local_path = None - self.source_disk_id = None - self.source_disk_name = None - self.seed_disk_name = None - self.test_migrate_disk_name = None - self.migrate_disk_name = None - self.is_os_disk = None - self.capacity_in_bytes = None - self.is_dynamic = None - self.disk_type = None - - -class VMwareToAzStackHCIProtectedItemModelCustomProperties( - ProtectedItemModelCustomProperties -): # pylint: disable=too-many-instance-attributes - """VMware to AzStackHCI Protected item model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar active_location: Gets or sets the location of the protected item. Known values are: - "Primary" and "Recovery". - :vartype active_location: str or - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemActiveLocation - :ivar target_hci_cluster_id: Gets or sets the Target HCI Cluster ARM Id. Required. - :vartype target_hci_cluster_id: str - :ivar target_arc_cluster_custom_location_id: Gets or sets the Target Arc Cluster Custom - Location ARM Id. Required. - :vartype target_arc_cluster_custom_location_id: str - :ivar target_az_stack_hci_cluster_name: Gets or sets the Target AzStackHCI cluster name. - :vartype target_az_stack_hci_cluster_name: str - :ivar storage_container_id: Gets or sets the target storage container ARM Id. Required. - :vartype storage_container_id: str - :ivar target_resource_group_id: Gets or sets the target resource group ARM Id. Required. - :vartype target_resource_group_id: str - :ivar target_location: Gets or sets the target location. - :vartype target_location: str - :ivar custom_location_region: Gets or sets the location of Azure Arc HCI custom location - resource. Required. - :vartype custom_location_region: str - :ivar disks_to_include: Gets or sets the list of disks to replicate. Required. - :vartype disks_to_include: - list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIDiskInput] - :ivar nics_to_include: Gets or sets the list of VM NIC to replicate. Required. - :vartype nics_to_include: - list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCINicInput] - :ivar protected_disks: Gets or sets the list of protected disks. - :vartype protected_disks: - list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIProtectedDiskProperties] - :ivar protected_nics: Gets or sets the VM NIC details. - :vartype protected_nics: - list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIProtectedNicProperties] - :ivar target_vm_bios_id: Gets or sets the BIOS Id of the target AzStackHCI VM. - :vartype target_vm_bios_id: str - :ivar target_vm_name: Gets or sets the target VM display name. - :vartype target_vm_name: str - :ivar hyper_v_generation: Gets or sets the hypervisor generation of the virtual machine - possible values are 1,2. Required. - :vartype hyper_v_generation: str - :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - :vartype target_network_id: str - :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - :vartype test_network_id: str - :ivar target_cpu_cores: Gets or sets the target CPU cores. - :vartype target_cpu_cores: int - :ivar is_dynamic_ram: Gets or sets a value indicating whether memory is dynamical. - :vartype is_dynamic_ram: bool - :ivar dynamic_memory_config: Protected item dynamic memory config. - :vartype dynamic_memory_config: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemDynamicMemoryConfig - :ivar target_memory_in_mega_bytes: Gets or sets the target memory in mega-bytes. - :vartype target_memory_in_mega_bytes: int - :ivar os_type: Gets or sets the type of the OS. - :vartype os_type: str - :ivar os_name: Gets or sets the name of the OS. - :vartype os_name: str - :ivar firmware_type: Gets or sets the firmware type. - :vartype firmware_type: str - :ivar fabric_discovery_machine_id: Gets or sets the ARM Id of the discovered machine. Required. - :vartype fabric_discovery_machine_id: str - :ivar source_vm_name: Gets or sets the source VM display name. - :vartype source_vm_name: str - :ivar source_cpu_cores: Gets or sets the source VM CPU cores. - :vartype source_cpu_cores: int - :ivar source_memory_in_mega_bytes: Gets or sets the source VM ram memory size in megabytes. - :vartype source_memory_in_mega_bytes: float - :ivar run_as_account_id: Gets or sets the run as account Id. Required. - :vartype run_as_account_id: str - :ivar source_dra_name: Gets or sets the source DRA name. Required. - :vartype source_dra_name: str - :ivar target_dra_name: Gets or sets the target DRA name. Required. - :vartype target_dra_name: str - :ivar source_appliance_name: Gets or sets the source appliance name. - :vartype source_appliance_name: str - :ivar target_appliance_name: Gets or sets the target appliance name. - :vartype target_appliance_name: str - :ivar failover_recovery_point_id: Gets or sets the recovery point Id to which the VM was failed - over. - :vartype failover_recovery_point_id: str - :ivar last_recovery_point_received: Gets or sets the last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :ivar last_recovery_point_id: Gets or sets the last recovery point Id. - :vartype last_recovery_point_id: str - :ivar initial_replication_progress_percentage: Gets or sets the initial replication progress - percentage. This is calculated based on - total bytes processed for all disks in the source VM. - :vartype initial_replication_progress_percentage: int - :ivar migration_progress_percentage: Gets or sets the migration progress percentage. - :vartype migration_progress_percentage: int - :ivar resume_progress_percentage: Gets or sets the resume progress percentage. - :vartype resume_progress_percentage: int - :ivar resync_progress_percentage: Gets or sets the resync progress percentage. This is - calculated based on total bytes - processed for all disks in the source VM. - :vartype resync_progress_percentage: int - :ivar resync_retry_count: Gets or sets the resync retry count. - :vartype resync_retry_count: int - :ivar resync_required: Gets or sets a value indicating whether resync is required. - :vartype resync_required: bool - :ivar resync_state: Gets or sets the resync state. Known values are: "None", - "PreparedForResynchronization", and "StartedResynchronization". - :vartype resync_state: str or - ~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzureMigrateResyncState - :ivar perform_auto_resync: Gets or sets a value indicating whether auto resync is to be done. - :vartype perform_auto_resync: bool - :ivar resume_retry_count: Gets or sets the resume retry count. - :vartype resume_retry_count: int - :ivar last_replication_update_time: Gets or sets the latest timestamp that replication status - is updated. - :vartype last_replication_update_time: ~datetime.datetime - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "active_location": {"readonly": True}, - "target_hci_cluster_id": {"required": True, "min_length": 1}, - "target_arc_cluster_custom_location_id": {"required": True, "min_length": 1}, - "target_az_stack_hci_cluster_name": {"readonly": True}, - "storage_container_id": {"required": True, "min_length": 1}, - "target_resource_group_id": {"required": True, "min_length": 1}, - "target_location": {"readonly": True}, - "custom_location_region": {"required": True, "min_length": 1}, - "disks_to_include": {"required": True, "min_items": 1}, - "nics_to_include": {"required": True, "min_items": 1}, - "protected_disks": {"readonly": True}, - "protected_nics": {"readonly": True}, - "target_vm_bios_id": {"readonly": True}, - "hyper_v_generation": {"required": True, "min_length": 1}, - "os_type": {"readonly": True}, - "os_name": {"readonly": True}, - "firmware_type": {"readonly": True}, - "fabric_discovery_machine_id": {"required": True, "min_length": 1}, - "source_vm_name": {"readonly": True}, - "source_cpu_cores": {"readonly": True}, - "source_memory_in_mega_bytes": {"readonly": True}, - "run_as_account_id": {"required": True, "min_length": 1}, - "source_dra_name": {"required": True, "min_length": 1}, - "target_dra_name": {"required": True, "min_length": 1}, - "source_appliance_name": {"readonly": True}, - "target_appliance_name": {"readonly": True}, - "failover_recovery_point_id": {"readonly": True}, - "last_recovery_point_received": {"readonly": True}, - "last_recovery_point_id": {"readonly": True}, - "initial_replication_progress_percentage": {"readonly": True}, - "migration_progress_percentage": {"readonly": True}, - "resume_progress_percentage": {"readonly": True}, - "resync_progress_percentage": {"readonly": True}, - "resync_retry_count": {"readonly": True}, - "resync_required": {"readonly": True}, - "resync_state": {"readonly": True}, - "resume_retry_count": {"readonly": True}, - "last_replication_update_time": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "active_location": {"key": "activeLocation", "type": "str"}, - "target_hci_cluster_id": {"key": "targetHciClusterId", "type": "str"}, - "target_arc_cluster_custom_location_id": {"key": "targetArcClusterCustomLocationId", "type": "str"}, - "target_az_stack_hci_cluster_name": {"key": "targetAzStackHciClusterName", "type": "str"}, - "storage_container_id": {"key": "storageContainerId", "type": "str"}, - "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, - "target_location": {"key": "targetLocation", "type": "str"}, - "custom_location_region": {"key": "customLocationRegion", "type": "str"}, - "disks_to_include": {"key": "disksToInclude", "type": "[VMwareToAzStackHCIDiskInput]"}, - "nics_to_include": {"key": "nicsToInclude", "type": "[VMwareToAzStackHCINicInput]"}, - "protected_disks": {"key": "protectedDisks", "type": "[VMwareToAzStackHCIProtectedDiskProperties]"}, - "protected_nics": {"key": "protectedNics", "type": "[VMwareToAzStackHCIProtectedNicProperties]"}, - "target_vm_bios_id": {"key": "targetVmBiosId", "type": "str"}, - "target_vm_name": {"key": "targetVmName", "type": "str"}, - "hyper_v_generation": {"key": "hyperVGeneration", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "target_cpu_cores": {"key": "targetCpuCores", "type": "int"}, - "is_dynamic_ram": {"key": "isDynamicRam", "type": "bool"}, - "dynamic_memory_config": {"key": "dynamicMemoryConfig", "type": "ProtectedItemDynamicMemoryConfig"}, - "target_memory_in_mega_bytes": {"key": "targetMemoryInMegaBytes", "type": "int"}, - "os_type": {"key": "osType", "type": "str"}, - "os_name": {"key": "osName", "type": "str"}, - "firmware_type": {"key": "firmwareType", "type": "str"}, - "fabric_discovery_machine_id": {"key": "fabricDiscoveryMachineId", "type": "str"}, - "source_vm_name": {"key": "sourceVmName", "type": "str"}, - "source_cpu_cores": {"key": "sourceCpuCores", "type": "int"}, - "source_memory_in_mega_bytes": {"key": "sourceMemoryInMegaBytes", "type": "float"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "source_dra_name": {"key": "sourceDraName", "type": "str"}, - "target_dra_name": {"key": "targetDraName", "type": "str"}, - "source_appliance_name": {"key": "sourceApplianceName", "type": "str"}, - "target_appliance_name": {"key": "targetApplianceName", "type": "str"}, - "failover_recovery_point_id": {"key": "failoverRecoveryPointId", "type": "str"}, - "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, - "last_recovery_point_id": {"key": "lastRecoveryPointId", "type": "str"}, - "initial_replication_progress_percentage": {"key": "initialReplicationProgressPercentage", "type": "int"}, - "migration_progress_percentage": {"key": "migrationProgressPercentage", "type": "int"}, - "resume_progress_percentage": {"key": "resumeProgressPercentage", "type": "int"}, - "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, - "resync_retry_count": {"key": "resyncRetryCount", "type": "int"}, - "resync_required": {"key": "resyncRequired", "type": "bool"}, - "resync_state": {"key": "resyncState", "type": "str"}, - "perform_auto_resync": {"key": "performAutoResync", "type": "bool"}, - "resume_retry_count": {"key": "resumeRetryCount", "type": "int"}, - "last_replication_update_time": {"key": "lastReplicationUpdateTime", "type": "iso-8601"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - target_hci_cluster_id: str, - target_arc_cluster_custom_location_id: str, - storage_container_id: str, - target_resource_group_id: str, - custom_location_region: str, - disks_to_include: List["_models.VMwareToAzStackHCIDiskInput"], - nics_to_include: List["_models.VMwareToAzStackHCINicInput"], - hyper_v_generation: str, - fabric_discovery_machine_id: str, - run_as_account_id: str, - source_dra_name: str, - target_dra_name: str, - target_vm_name: Optional[str] = None, - target_network_id: Optional[str] = None, - test_network_id: Optional[str] = None, - target_cpu_cores: Optional[int] = None, - is_dynamic_ram: Optional[bool] = None, - dynamic_memory_config: Optional["_models.ProtectedItemDynamicMemoryConfig"] = None, - target_memory_in_mega_bytes: Optional[int] = None, - perform_auto_resync: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_hci_cluster_id: Gets or sets the Target HCI Cluster ARM Id. Required. - :paramtype target_hci_cluster_id: str - :keyword target_arc_cluster_custom_location_id: Gets or sets the Target Arc Cluster Custom - Location ARM Id. Required. - :paramtype target_arc_cluster_custom_location_id: str - :keyword storage_container_id: Gets or sets the target storage container ARM Id. Required. - :paramtype storage_container_id: str - :keyword target_resource_group_id: Gets or sets the target resource group ARM Id. Required. - :paramtype target_resource_group_id: str - :keyword custom_location_region: Gets or sets the location of Azure Arc HCI custom location - resource. Required. - :paramtype custom_location_region: str - :keyword disks_to_include: Gets or sets the list of disks to replicate. Required. - :paramtype disks_to_include: - list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCIDiskInput] - :keyword nics_to_include: Gets or sets the list of VM NIC to replicate. Required. - :paramtype nics_to_include: - list[~azure.mgmt.recoveryservicesdatareplication.models.VMwareToAzStackHCINicInput] - :keyword target_vm_name: Gets or sets the target VM display name. - :paramtype target_vm_name: str - :keyword hyper_v_generation: Gets or sets the hypervisor generation of the virtual machine - possible values are 1,2. Required. - :paramtype hyper_v_generation: str - :keyword target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - :paramtype target_network_id: str - :keyword test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - :paramtype test_network_id: str - :keyword target_cpu_cores: Gets or sets the target CPU cores. - :paramtype target_cpu_cores: int - :keyword is_dynamic_ram: Gets or sets a value indicating whether memory is dynamical. - :paramtype is_dynamic_ram: bool - :keyword dynamic_memory_config: Protected item dynamic memory config. - :paramtype dynamic_memory_config: - ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemDynamicMemoryConfig - :keyword target_memory_in_mega_bytes: Gets or sets the target memory in mega-bytes. - :paramtype target_memory_in_mega_bytes: int - :keyword fabric_discovery_machine_id: Gets or sets the ARM Id of the discovered machine. - Required. - :paramtype fabric_discovery_machine_id: str - :keyword run_as_account_id: Gets or sets the run as account Id. Required. - :paramtype run_as_account_id: str - :keyword source_dra_name: Gets or sets the source DRA name. Required. - :paramtype source_dra_name: str - :keyword target_dra_name: Gets or sets the target DRA name. Required. - :paramtype target_dra_name: str - :keyword perform_auto_resync: Gets or sets a value indicating whether auto resync is to be - done. - :paramtype perform_auto_resync: bool - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareToAzStackHCI" - self.active_location = None - self.target_hci_cluster_id = target_hci_cluster_id - self.target_arc_cluster_custom_location_id = target_arc_cluster_custom_location_id - self.target_az_stack_hci_cluster_name = None - self.storage_container_id = storage_container_id - self.target_resource_group_id = target_resource_group_id - self.target_location = None - self.custom_location_region = custom_location_region - self.disks_to_include = disks_to_include - self.nics_to_include = nics_to_include - self.protected_disks = None - self.protected_nics = None - self.target_vm_bios_id = None - self.target_vm_name = target_vm_name - self.hyper_v_generation = hyper_v_generation - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.target_cpu_cores = target_cpu_cores - self.is_dynamic_ram = is_dynamic_ram - self.dynamic_memory_config = dynamic_memory_config - self.target_memory_in_mega_bytes = target_memory_in_mega_bytes - self.os_type = None - self.os_name = None - self.firmware_type = None - self.fabric_discovery_machine_id = fabric_discovery_machine_id - self.source_vm_name = None - self.source_cpu_cores = None - self.source_memory_in_mega_bytes = None - self.run_as_account_id = run_as_account_id - self.source_dra_name = source_dra_name - self.target_dra_name = target_dra_name - self.source_appliance_name = None - self.target_appliance_name = None - self.failover_recovery_point_id = None - self.last_recovery_point_received = None - self.last_recovery_point_id = None - self.initial_replication_progress_percentage = None - self.migration_progress_percentage = None - self.resume_progress_percentage = None - self.resync_progress_percentage = None - self.resync_retry_count = None - self.resync_required = None - self.resync_state = None - self.perform_auto_resync = perform_auto_resync - self.resume_retry_count = None - self.last_replication_update_time = None - - -class VMwareToAzStackHCIProtectedNicProperties(_serialization.Model): - """VMwareToAzStackHCI NIC properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar nic_id: Gets or sets the NIC Id. - :vartype nic_id: str - :ivar mac_address: Gets or sets the NIC mac address. - :vartype mac_address: str - :ivar label: Gets or sets the NIC label. - :vartype label: str - :ivar is_primary_nic: Gets or sets a value indicating whether this is the primary NIC. - :vartype is_primary_nic: bool - :ivar network_name: Gets or sets the network name. - :vartype network_name: str - :ivar target_network_id: Gets or sets the target network Id within AzStackHCI Cluster. - :vartype target_network_id: str - :ivar test_network_id: Gets or sets the target test network Id within AzStackHCI Cluster. - :vartype test_network_id: str - :ivar selection_type_for_failover: Gets or sets the selection type of the NIC. Known values - are: "NotSelected", "SelectedByUser", "SelectedByDefault", and "SelectedByUserOverride". - :vartype selection_type_for_failover: str or - ~azure.mgmt.recoveryservicesdatareplication.models.VMNicSelection - """ - - _validation = { - "nic_id": {"readonly": True}, - "mac_address": {"readonly": True}, - "label": {"readonly": True}, - "network_name": {"readonly": True}, - "target_network_id": {"readonly": True}, - "test_network_id": {"readonly": True}, - "selection_type_for_failover": {"readonly": True}, - } - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "mac_address": {"key": "macAddress", "type": "str"}, - "label": {"key": "label", "type": "str"}, - "is_primary_nic": {"key": "isPrimaryNic", "type": "bool"}, - "network_name": {"key": "networkName", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "selection_type_for_failover": {"key": "selectionTypeForFailover", "type": "str"}, - } - - def __init__(self, *, is_primary_nic: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword is_primary_nic: Gets or sets a value indicating whether this is the primary NIC. - :paramtype is_primary_nic: bool - """ - super().__init__(**kwargs) - self.nic_id = None - self.mac_address = None - self.label = None - self.is_primary_nic = is_primary_nic - self.network_name = None - self.target_network_id = None - self.test_network_id = None - self.selection_type_for_failover = None - - -class VMwareToAzStackHCIReplicationExtensionModelCustomProperties( - ReplicationExtensionModelCustomProperties -): # pylint: disable=too-many-instance-attributes - """VMware to AzStackHCI Replication extension model custom properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar instance_type: Gets or sets the instance type. Required. - :vartype instance_type: str - :ivar vmware_fabric_arm_id: Gets or sets the ARM Id of the source VMware fabric. Required. - :vartype vmware_fabric_arm_id: str - :ivar vmware_site_id: Gets or sets the ARM Id of the VMware site. - :vartype vmware_site_id: str - :ivar az_stack_hci_fabric_arm_id: Gets or sets the ARM Id of the target AzStackHCI fabric. - Required. - :vartype az_stack_hci_fabric_arm_id: str - :ivar az_stack_hci_site_id: Gets or sets the ARM Id of the AzStackHCI site. - :vartype az_stack_hci_site_id: str - :ivar storage_account_id: Gets or sets the storage account Id. - :vartype storage_account_id: str - :ivar storage_account_sas_secret_name: Gets or sets the Sas Secret of storage account. - :vartype storage_account_sas_secret_name: str - :ivar asr_service_uri: Gets or sets the Uri of ASR. - :vartype asr_service_uri: str - :ivar rcm_service_uri: Gets or sets the Uri of Rcm. - :vartype rcm_service_uri: str - :ivar gateway_service_uri: Gets or sets the Uri of Gateway. - :vartype gateway_service_uri: str - :ivar source_gateway_service_id: Gets or sets the gateway service Id of source. - :vartype source_gateway_service_id: str - :ivar target_gateway_service_id: Gets or sets the gateway service Id of target. - :vartype target_gateway_service_id: str - :ivar source_storage_container_name: Gets or sets the source storage container name. - :vartype source_storage_container_name: str - :ivar target_storage_container_name: Gets or sets the target storage container name. - :vartype target_storage_container_name: str - :ivar resource_location: Gets or sets the resource location. - :vartype resource_location: str - :ivar subscription_id: Gets or sets the subscription. - :vartype subscription_id: str - :ivar resource_group: Gets or sets the resource group. - :vartype resource_group: str - """ - - _validation = { - "instance_type": {"required": True, "min_length": 1}, - "vmware_fabric_arm_id": {"required": True, "min_length": 1}, - "vmware_site_id": {"readonly": True}, - "az_stack_hci_fabric_arm_id": {"required": True, "min_length": 1}, - "az_stack_hci_site_id": {"readonly": True}, - "asr_service_uri": {"readonly": True}, - "rcm_service_uri": {"readonly": True}, - "gateway_service_uri": {"readonly": True}, - "source_gateway_service_id": {"readonly": True}, - "target_gateway_service_id": {"readonly": True}, - "source_storage_container_name": {"readonly": True}, - "target_storage_container_name": {"readonly": True}, - "resource_location": {"readonly": True}, - "subscription_id": {"readonly": True}, - "resource_group": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vmware_fabric_arm_id": {"key": "vmwareFabricArmId", "type": "str"}, - "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, - "az_stack_hci_fabric_arm_id": {"key": "azStackHciFabricArmId", "type": "str"}, - "az_stack_hci_site_id": {"key": "azStackHciSiteId", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "storage_account_sas_secret_name": {"key": "storageAccountSasSecretName", "type": "str"}, - "asr_service_uri": {"key": "asrServiceUri", "type": "str"}, - "rcm_service_uri": {"key": "rcmServiceUri", "type": "str"}, - "gateway_service_uri": {"key": "gatewayServiceUri", "type": "str"}, - "source_gateway_service_id": {"key": "sourceGatewayServiceId", "type": "str"}, - "target_gateway_service_id": {"key": "targetGatewayServiceId", "type": "str"}, - "source_storage_container_name": {"key": "sourceStorageContainerName", "type": "str"}, - "target_storage_container_name": {"key": "targetStorageContainerName", "type": "str"}, - "resource_location": {"key": "resourceLocation", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "resource_group": {"key": "resourceGroup", "type": "str"}, - } - - def __init__( - self, - *, - vmware_fabric_arm_id: str, - az_stack_hci_fabric_arm_id: str, - storage_account_id: Optional[str] = None, - storage_account_sas_secret_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vmware_fabric_arm_id: Gets or sets the ARM Id of the source VMware fabric. Required. - :paramtype vmware_fabric_arm_id: str - :keyword az_stack_hci_fabric_arm_id: Gets or sets the ARM Id of the target AzStackHCI fabric. - Required. - :paramtype az_stack_hci_fabric_arm_id: str - :keyword storage_account_id: Gets or sets the storage account Id. - :paramtype storage_account_id: str - :keyword storage_account_sas_secret_name: Gets or sets the Sas Secret of storage account. - :paramtype storage_account_sas_secret_name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareToAzStackHCI" - self.vmware_fabric_arm_id = vmware_fabric_arm_id - self.vmware_site_id = None - self.az_stack_hci_fabric_arm_id = az_stack_hci_fabric_arm_id - self.az_stack_hci_site_id = None - self.storage_account_id = storage_account_id - self.storage_account_sas_secret_name = storage_account_sas_secret_name - self.asr_service_uri = None - self.rcm_service_uri = None - self.gateway_service_uri = None - self.source_gateway_service_id = None - self.target_gateway_service_id = None - self.source_storage_container_name = None - self.target_storage_container_name = None - self.resource_location = None - self.subscription_id = None - self.resource_group = None - - -class WorkflowModel(_serialization.Model): - """Workflow model. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Workflow model properties. Required. - :vartype properties: ~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModelProperties - :ivar id: Gets or sets the Id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar system_data: - :vartype system_data: - ~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModelSystemData - """ - - _validation = { - "properties": {"required": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "WorkflowModelProperties"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "WorkflowModelSystemData"}, - } - - def __init__(self, *, properties: "_models.WorkflowModelProperties", **kwargs: Any) -> None: - """ - :keyword properties: Workflow model properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModelProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class WorkflowModelCollection(_serialization.Model): - """Workflow model collection. - - :ivar value: Gets or sets the list of workflows. - :vartype value: list[~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModel] - :ivar next_link: Gets or sets the value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[WorkflowModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.WorkflowModel"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the list of workflows. - :paramtype value: list[~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModel] - :keyword next_link: Gets or sets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class WorkflowModelProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Workflow model properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar display_name: Gets or sets the friendly display name. - :vartype display_name: str - :ivar state: Gets or sets the workflow state. Known values are: "Pending", "Started", - "Cancelling", "Succeeded", "Failed", "Cancelled", "CompletedWithInformation", - "CompletedWithWarnings", and "CompletedWithErrors". - :vartype state: str or ~azure.mgmt.recoveryservicesdatareplication.models.WorkflowState - :ivar start_time: Gets or sets the start time. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets or sets the end time. - :vartype end_time: ~datetime.datetime - :ivar object_id: Gets or sets the affected object Id. - :vartype object_id: str - :ivar object_name: Gets or sets the affected object name. - :vartype object_name: str - :ivar object_internal_id: Gets or sets the affected object internal Id. - :vartype object_internal_id: str - :ivar object_internal_name: Gets or sets the affected object internal name. - :vartype object_internal_name: str - :ivar object_type: Gets or sets the object type. Known values are: "AvsDiskPool", "Dra", - "Fabric", "Policy", "ProtectedItem", "RecoveryPlan", "ReplicationExtension", and "Vault". - :vartype object_type: str or - ~azure.mgmt.recoveryservicesdatareplication.models.WorkflowObjectType - :ivar replication_provider_id: Gets or sets the replication provider. - :vartype replication_provider_id: str - :ivar source_fabric_provider_id: Gets or sets the source fabric provider. - :vartype source_fabric_provider_id: str - :ivar target_fabric_provider_id: Gets or sets the target fabric provider. - :vartype target_fabric_provider_id: str - :ivar allowed_actions: Gets or sets the list of allowed actions on the workflow. - :vartype allowed_actions: list[str] - :ivar activity_id: Gets or sets the workflow activity id. - :vartype activity_id: str - :ivar tasks: Gets or sets the list of tasks. - :vartype tasks: list[~azure.mgmt.recoveryservicesdatareplication.models.TaskModel] - :ivar errors: Gets or sets the list of errors. - :vartype errors: list[~azure.mgmt.recoveryservicesdatareplication.models.ErrorModel] - :ivar custom_properties: Workflow model custom properties. Required. - :vartype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModelCustomProperties - """ - - _validation = { - "display_name": {"readonly": True}, - "state": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - "object_id": {"readonly": True}, - "object_name": {"readonly": True}, - "object_internal_id": {"readonly": True}, - "object_internal_name": {"readonly": True}, - "object_type": {"readonly": True}, - "replication_provider_id": {"readonly": True}, - "source_fabric_provider_id": {"readonly": True}, - "target_fabric_provider_id": {"readonly": True}, - "allowed_actions": {"readonly": True}, - "activity_id": {"readonly": True}, - "tasks": {"readonly": True}, - "errors": {"readonly": True}, - "custom_properties": {"required": True}, - } - - _attribute_map = { - "display_name": {"key": "displayName", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "object_id": {"key": "objectId", "type": "str"}, - "object_name": {"key": "objectName", "type": "str"}, - "object_internal_id": {"key": "objectInternalId", "type": "str"}, - "object_internal_name": {"key": "objectInternalName", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - "replication_provider_id": {"key": "replicationProviderId", "type": "str"}, - "source_fabric_provider_id": {"key": "sourceFabricProviderId", "type": "str"}, - "target_fabric_provider_id": {"key": "targetFabricProviderId", "type": "str"}, - "allowed_actions": {"key": "allowedActions", "type": "[str]"}, - "activity_id": {"key": "activityId", "type": "str"}, - "tasks": {"key": "tasks", "type": "[TaskModel]"}, - "errors": {"key": "errors", "type": "[ErrorModel]"}, - "custom_properties": {"key": "customProperties", "type": "WorkflowModelCustomProperties"}, - } - - def __init__(self, *, custom_properties: "_models.WorkflowModelCustomProperties", **kwargs: Any) -> None: - """ - :keyword custom_properties: Workflow model custom properties. Required. - :paramtype custom_properties: - ~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModelCustomProperties - """ - super().__init__(**kwargs) - self.display_name = None - self.state = None - self.start_time = None - self.end_time = None - self.object_id = None - self.object_name = None - self.object_internal_id = None - self.object_internal_name = None - self.object_type = None - self.replication_provider_id = None - self.source_fabric_provider_id = None - self.target_fabric_provider_id = None - self.allowed_actions = None - self.activity_id = None - self.tasks = None - self.errors = None - self.custom_properties = custom_properties - - -class WorkflowModelSystemData(SystemDataModel): - """WorkflowModelSystemData. - - :ivar created_by: Gets or sets identity that created the resource. - :vartype created_by: str - :ivar created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :vartype created_by_type: str - :ivar created_at: Gets or sets the timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: Gets or sets the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: Gets or sets the type of identity that last modified the resource: - user, application, - managedIdentity. - :vartype last_modified_by_type: str - :ivar last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: Gets or sets identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: Gets or sets the type of identity that created the resource: user, - application, - managedIdentity. - :paramtype created_by_type: str - :keyword created_at: Gets or sets the timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: Gets or sets the identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: Gets or sets the type of identity that last modified the - resource: user, application, - managedIdentity. - :paramtype last_modified_by_type: str - :keyword last_modified_at: Gets or sets the timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__( - created_by=created_by, - created_by_type=created_by_type, - created_at=created_at, - last_modified_by=last_modified_by, - last_modified_by_type=last_modified_by_type, - last_modified_at=last_modified_at, - **kwargs - ) diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_patch.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_patch.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_recovery_services_data_replication_mgmt_client_enums.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_recovery_services_data_replication_mgmt_client_enums.py deleted file mode 100644 index df2f45098fc6..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/models/_recovery_services_data_replication_mgmt_client_enums.py +++ /dev/null @@ -1,202 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class HealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the fabric health.""" - - NORMAL = "Normal" - WARNING = "Warning" - CRITICAL = "Critical" - - -class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is "user,system". - """ - - USER = "user" - SYSTEM = "system" - USER_SYSTEM = "user,system" - - -class ProtectedItemActiveLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the location of the protected item.""" - - PRIMARY = "Primary" - RECOVERY = "Recovery" - - -class ProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the protection state.""" - - UNPROTECTED_STATES_BEGIN = "UnprotectedStatesBegin" - ENABLING_PROTECTION = "EnablingProtection" - ENABLING_FAILED = "EnablingFailed" - DISABLING_PROTECTION = "DisablingProtection" - MARKED_FOR_DELETION = "MarkedForDeletion" - DISABLING_FAILED = "DisablingFailed" - UNPROTECTED_STATES_END = "UnprotectedStatesEnd" - INITIAL_REPLICATION_STATES_BEGIN = "InitialReplicationStatesBegin" - INITIAL_REPLICATION_IN_PROGRESS = "InitialReplicationInProgress" - INITIAL_REPLICATION_COMPLETED_ON_PRIMARY = "InitialReplicationCompletedOnPrimary" - INITIAL_REPLICATION_COMPLETED_ON_RECOVERY = "InitialReplicationCompletedOnRecovery" - INITIAL_REPLICATION_FAILED = "InitialReplicationFailed" - INITIAL_REPLICATION_STATES_END = "InitialReplicationStatesEnd" - PROTECTED_STATES_BEGIN = "ProtectedStatesBegin" - PROTECTED = "Protected" - PROTECTED_STATES_END = "ProtectedStatesEnd" - PLANNED_FAILOVER_TRANSITION_STATES_BEGIN = "PlannedFailoverTransitionStatesBegin" - PLANNED_FAILOVER_INITIATED = "PlannedFailoverInitiated" - PLANNED_FAILOVER_COMPLETING = "PlannedFailoverCompleting" - PLANNED_FAILOVER_COMPLETED = "PlannedFailoverCompleted" - PLANNED_FAILOVER_FAILED = "PlannedFailoverFailed" - PLANNED_FAILOVER_COMPLETION_FAILED = "PlannedFailoverCompletionFailed" - PLANNED_FAILOVER_TRANSITION_STATES_END = "PlannedFailoverTransitionStatesEnd" - UNPLANNED_FAILOVER_TRANSITION_STATES_BEGIN = "UnplannedFailoverTransitionStatesBegin" - UNPLANNED_FAILOVER_INITIATED = "UnplannedFailoverInitiated" - UNPLANNED_FAILOVER_COMPLETING = "UnplannedFailoverCompleting" - UNPLANNED_FAILOVER_COMPLETED = "UnplannedFailoverCompleted" - UNPLANNED_FAILOVER_FAILED = "UnplannedFailoverFailed" - UNPLANNED_FAILOVER_COMPLETION_FAILED = "UnplannedFailoverCompletionFailed" - UNPLANNED_FAILOVER_TRANSITION_STATES_END = "UnplannedFailoverTransitionStatesEnd" - COMMIT_FAILOVER_STATES_BEGIN = "CommitFailoverStatesBegin" - COMMIT_FAILOVER_IN_PROGRESS_ON_PRIMARY = "CommitFailoverInProgressOnPrimary" - COMMIT_FAILOVER_IN_PROGRESS_ON_RECOVERY = "CommitFailoverInProgressOnRecovery" - COMMIT_FAILOVER_COMPLETED = "CommitFailoverCompleted" - COMMIT_FAILOVER_FAILED_ON_PRIMARY = "CommitFailoverFailedOnPrimary" - COMMIT_FAILOVER_FAILED_ON_RECOVERY = "CommitFailoverFailedOnRecovery" - COMMIT_FAILOVER_STATES_END = "CommitFailoverStatesEnd" - CANCEL_FAILOVER_STATES_BEGIN = "CancelFailoverStatesBegin" - CANCEL_FAILOVER_IN_PROGRESS_ON_PRIMARY = "CancelFailoverInProgressOnPrimary" - CANCEL_FAILOVER_IN_PROGRESS_ON_RECOVERY = "CancelFailoverInProgressOnRecovery" - CANCEL_FAILOVER_FAILED_ON_PRIMARY = "CancelFailoverFailedOnPrimary" - CANCEL_FAILOVER_FAILED_ON_RECOVERY = "CancelFailoverFailedOnRecovery" - CANCEL_FAILOVER_STATES_END = "CancelFailoverStatesEnd" - CHANGE_RECOVERY_POINT_STATES_BEGIN = "ChangeRecoveryPointStatesBegin" - CHANGE_RECOVERY_POINT_INITIATED = "ChangeRecoveryPointInitiated" - CHANGE_RECOVERY_POINT_COMPLETED = "ChangeRecoveryPointCompleted" - CHANGE_RECOVERY_POINT_FAILED = "ChangeRecoveryPointFailed" - CHANGE_RECOVERY_POINT_STATES_END = "ChangeRecoveryPointStatesEnd" - REPROTECT_STATES_BEGIN = "ReprotectStatesBegin" - REPROTECT_INITIATED = "ReprotectInitiated" - REPROTECT_FAILED = "ReprotectFailed" - REPROTECT_STATES_END = "ReprotectStatesEnd" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the provisioning state of the Dra.""" - - CANCELED = "Canceled" - CREATING = "Creating" - DELETING = "Deleting" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class RecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the recovery point type.""" - - APPLICATION_CONSISTENT = "ApplicationConsistent" - CRASH_CONSISTENT = "CrashConsistent" - - -class ReplicationVaultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of vault.""" - - DISASTER_RECOVERY = "DisasterRecovery" - MIGRATE = "Migrate" - - -class ResynchronizationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the resynchronization state.""" - - NONE = "None" - RESYNCHRONIZATION_INITIATED = "ResynchronizationInitiated" - RESYNCHRONIZATION_COMPLETED = "ResynchronizationCompleted" - RESYNCHRONIZATION_FAILED = "ResynchronizationFailed" - - -class TaskState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the task state.""" - - PENDING = "Pending" - STARTED = "Started" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELLED = "Cancelled" - SKIPPED = "Skipped" - - -class TestFailoverState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the test failover state.""" - - NONE = "None" - TEST_FAILOVER_INITIATED = "TestFailoverInitiated" - TEST_FAILOVER_COMPLETING = "TestFailoverCompleting" - TEST_FAILOVER_COMPLETED = "TestFailoverCompleted" - TEST_FAILOVER_FAILED = "TestFailoverFailed" - TEST_FAILOVER_COMPLETION_FAILED = "TestFailoverCompletionFailed" - TEST_FAILOVER_CLEANUP_INITIATED = "TestFailoverCleanupInitiated" - TEST_FAILOVER_CLEANUP_COMPLETING = "TestFailoverCleanupCompleting" - MARKED_FOR_DELETION = "MarkedForDeletion" - - -class VMNicSelection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the selection type of the NIC.""" - - NOT_SELECTED = "NotSelected" - SELECTED_BY_USER = "SelectedByUser" - SELECTED_BY_DEFAULT = "SelectedByDefault" - SELECTED_BY_USER_OVERRIDE = "SelectedByUserOverride" - - -class VMwareToAzureMigrateResyncState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the resync state.""" - - NONE = "None" - PREPARED_FOR_RESYNCHRONIZATION = "PreparedForResynchronization" - STARTED_RESYNCHRONIZATION = "StartedResynchronization" - - -class WorkflowObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the object type.""" - - AVS_DISK_POOL = "AvsDiskPool" - DRA = "Dra" - FABRIC = "Fabric" - POLICY = "Policy" - PROTECTED_ITEM = "ProtectedItem" - RECOVERY_PLAN = "RecoveryPlan" - REPLICATION_EXTENSION = "ReplicationExtension" - VAULT = "Vault" - - -class WorkflowState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the workflow state.""" - - PENDING = "Pending" - STARTED = "Started" - CANCELLING = "Cancelling" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELLED = "Cancelled" - COMPLETED_WITH_INFORMATION = "CompletedWithInformation" - COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" - COMPLETED_WITH_ERRORS = "CompletedWithErrors" diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/__init__.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/__init__.py index 08f3ec0219c3..5b972d92b8f8 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/__init__.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/__init__.py @@ -2,56 +2,58 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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 ._dra_operations import DraOperations -from ._dra_operation_status_operations import DraOperationStatusOperations -from ._email_configuration_operations import EmailConfigurationOperations -from ._event_operations import EventOperations -from ._fabric_operations import FabricOperations -from ._fabric_operations_status_operations import FabricOperationsStatusOperations -from ._policy_operations import PolicyOperations -from ._policy_operation_status_operations import PolicyOperationStatusOperations -from ._protected_item_operations import ProtectedItemOperations -from ._protected_item_operation_status_operations import ProtectedItemOperationStatusOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._replication_extension_operations import ReplicationExtensionOperations -from ._replication_extension_operation_status_operations import ReplicationExtensionOperationStatusOperations -from ._recovery_services_data_replication_mgmt_client_operations import ( - RecoveryServicesDataReplicationMgmtClientOperationsMixin, -) -from ._operations import Operations -from ._vault_operations import VaultOperations -from ._vault_operation_status_operations import VaultOperationStatusOperations -from ._workflow_operations import WorkflowOperations -from ._workflow_operation_status_operations import WorkflowOperationStatusOperations +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 EmailConfigurationOperations # type: ignore +from ._operations import VaultOperations # type: ignore +from ._operations import EventOperations # type: ignore +from ._operations import FabricOperations # type: ignore +from ._operations import FabricAgentOperations # type: ignore +from ._operations import JobOperations # type: ignore +from ._operations import PolicyOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import PrivateEndpointConnectionProxiesOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import ProtectedItemOperations # type: ignore +from ._operations import RecoveryPointOperations # type: ignore +from ._operations import ReplicationExtensionOperations # type: ignore +from ._operations import CheckNameAvailabilityOperations # type: ignore +from ._operations import DeploymentPreflightOperations # type: ignore +from ._operations import OperationResultsOperations # type: ignore +from ._operations import LocationBasedOperationResultsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "DraOperations", - "DraOperationStatusOperations", + "Operations", "EmailConfigurationOperations", + "VaultOperations", "EventOperations", "FabricOperations", - "FabricOperationsStatusOperations", + "FabricAgentOperations", + "JobOperations", "PolicyOperations", - "PolicyOperationStatusOperations", + "PrivateEndpointConnectionsOperations", + "PrivateEndpointConnectionProxiesOperations", + "PrivateLinkResourcesOperations", "ProtectedItemOperations", - "ProtectedItemOperationStatusOperations", - "RecoveryPointsOperations", + "RecoveryPointOperations", "ReplicationExtensionOperations", - "ReplicationExtensionOperationStatusOperations", - "RecoveryServicesDataReplicationMgmtClientOperationsMixin", - "Operations", - "VaultOperations", - "VaultOperationStatusOperations", - "WorkflowOperations", - "WorkflowOperationStatusOperations", + "CheckNameAvailabilityOperations", + "DeploymentPreflightOperations", + "OperationResultsOperations", + "LocationBasedOperationResultsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_dra_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_dra_operation_status_operations.py deleted file mode 100644 index 977ad0befa9a..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_dra_operation_status_operations.py +++ /dev/null @@ -1,167 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - fabric_name: str, - fabric_agent_name: str, - operation_id: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}/operations/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "fabricAgentName": _SERIALIZER.url("fabric_agent_name", fabric_agent_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class DraOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`dra_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the fabric agent (Dra) operation status. - - Tracks the results of an asynchronous operation on the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_dra_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_dra_operations.py deleted file mode 100644 index 5262955f1869..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_dra_operations.py +++ /dev/null @@ -1,735 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, fabric_name: str, fabric_agent_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "fabricAgentName": _SERIALIZER.url("fabric_agent_name", fabric_agent_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, fabric_name: str, fabric_agent_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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "fabricAgentName": _SERIALIZER.url("fabric_agent_name", fabric_agent_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fabric_name: str, fabric_agent_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "fabricAgentName": _SERIALIZER.url("fabric_agent_name", fabric_agent_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, fabric_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _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 DraOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`dra` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, **kwargs: Any - ) -> _models.DraModel: - """Gets the fabric agent (Dra). - - Gets the details of the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DraModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DraModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DraModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DraModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - def _create_initial( - self, - resource_group_name: str, - fabric_name: str, - fabric_agent_name: str, - body: Optional[Union[_models.DraModel, IO]] = None, - **kwargs: Any - ) -> _models.DraModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DraModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "DraModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DraModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DraModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - fabric_name: str, - fabric_agent_name: str, - body: Optional[_models.DraModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DraModel]: - """Puts the fabric agent (Dra). - - Creates the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :param body: Dra model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DraModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DraModel or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - fabric_name: str, - fabric_agent_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DraModel]: - """Puts the fabric agent (Dra). - - Creates the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :param body: Dra model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DraModel or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - fabric_name: str, - fabric_agent_name: str, - body: Optional[Union[_models.DraModel, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.DraModel]: - """Puts the fabric agent (Dra). - - Creates the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :param body: Dra model. Is either a DraModel type or a IO type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DraModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DraModel or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DraModel] = 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, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DraModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the fabric agent (Dra). - - Deletes the fabric agent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param fabric_agent_name: The fabric agent (Dra) name. Required. - :type fabric_agent_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - fabric_name=fabric_name, - fabric_agent_name=fabric_agent_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" - } - - @distributed_trace - def list(self, resource_group_name: str, fabric_name: str, **kwargs: Any) -> Iterable["_models.DraModel"]: - """Lists the fabric agents (Dras). - - Gets the list of fabric agents in the given fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DraModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.DraModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DraModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DraModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_email_configuration_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_email_configuration_operations.py deleted file mode 100644 index 76eb74a3aa7c..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_email_configuration_operations.py +++ /dev/null @@ -1,495 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_name: str, email_configuration_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "emailConfigurationName": _SERIALIZER.url( - "email_configuration_name", email_configuration_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, vault_name: str, email_configuration_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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "emailConfigurationName": _SERIALIZER.url( - "email_configuration_name", email_configuration_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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_list_request(resource_group_name: str, 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _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 EmailConfigurationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`email_configuration` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, email_configuration_name: str, **kwargs: Any - ) -> _models.EmailConfigurationModel: - """Gets the email configuration setting. - - Gets the details of the alert configuration setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param email_configuration_name: The email configuration name. Required. - :type email_configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmailConfigurationModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EmailConfigurationModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - email_configuration_name=email_configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EmailConfigurationModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" - } - - @overload - def create( - self, - resource_group_name: str, - vault_name: str, - email_configuration_name: str, - body: Optional[_models.EmailConfigurationModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EmailConfigurationModel: - """Creates email configuration settings. - - Creates an alert configuration setting for the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param email_configuration_name: The email configuration name. Required. - :type email_configuration_name: str - :param body: EmailConfiguration model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmailConfigurationModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - vault_name: str, - email_configuration_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EmailConfigurationModel: - """Creates email configuration settings. - - Creates an alert configuration setting for the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param email_configuration_name: The email configuration name. Required. - :type email_configuration_name: str - :param body: EmailConfiguration model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmailConfigurationModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - vault_name: str, - email_configuration_name: str, - body: Optional[Union[_models.EmailConfigurationModel, IO]] = None, - **kwargs: Any - ) -> _models.EmailConfigurationModel: - """Creates email configuration settings. - - Creates an alert configuration setting for the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param email_configuration_name: The email configuration name. Required. - :type email_configuration_name: str - :param body: EmailConfiguration model. Is either a EmailConfigurationModel type or a IO type. - Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmailConfigurationModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EmailConfigurationModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "EmailConfigurationModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - email_configuration_name=email_configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("EmailConfigurationModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EmailConfigurationModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.EmailConfigurationModel"]: - """Lists the email configuration settings. - - Gets the list of alert configuration settings for the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EmailConfigurationModel or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EmailConfigurationModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("EmailConfigurationModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_event_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_event_operations.py deleted file mode 100644 index b4a46cef69b4..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_event_operations.py +++ /dev/null @@ -1,309 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_name: str, event_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "eventName": _SERIALIZER.url("event_name", event_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - vault_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - continuation_token_parameter: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) - _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 EventOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`event` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, vault_name: str, event_name: str, **kwargs: Any) -> _models.EventModel: - """Gets the event. - - Gets the details of the event. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param event_name: The event name. Required. - :type event_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EventModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EventModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EventModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - event_name=event_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EventModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}" - } - - @distributed_trace - def list( - self, - resource_group_name: str, - vault_name: str, - filter: Optional[str] = None, - continuation_token_parameter: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.EventModel"]: - """Lists the events. - - Gets the list of events in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param filter: Filter string. Default value is None. - :type filter: str - :param continuation_token_parameter: Continuation token. Default value is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.EventModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EventModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - filter=filter, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("EventModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_fabric_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_fabric_operations.py deleted file mode 100644 index 8656e8d9e466..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_fabric_operations.py +++ /dev/null @@ -1,1124 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, fabric_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, fabric_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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fabric_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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fabric_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request( - subscription_id: str, *, continuation_token_parameter: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, subscription_id: str, *, continuation_token_parameter: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) - _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 FabricOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`fabric` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, fabric_name: str, **kwargs: Any) -> _models.FabricModel: - """Gets the fabric. - - Gets the details of the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: FabricModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FabricModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FabricModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - def _create_initial( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[Union[_models.FabricModel, IO]] = None, - **kwargs: Any - ) -> _models.FabricModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FabricModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "FabricModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("FabricModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FabricModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[_models.FabricModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FabricModel]: - """Puts the fabric. - - Creates the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FabricModel]: - """Puts the fabric. - - Creates the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[Union[_models.FabricModel, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.FabricModel]: - """Puts the fabric. - - Creates the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Is either a FabricModel type or a IO type. Default value is - None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FabricModel] = 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, - fabric_name=fabric_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FabricModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - def _update_initial( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[Union[_models.FabricModelUpdate, IO]] = None, - **kwargs: Any - ) -> Optional[_models.FabricModel]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FabricModel]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "FabricModelUpdate") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("FabricModel", pipeline_response) - - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[_models.FabricModelUpdate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FabricModel]: - """Updates the fabric. - - Performs update on the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FabricModel]: - """Updates the fabric. - - Performs update on the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fabric_name: str, - body: Optional[Union[_models.FabricModelUpdate, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.FabricModel]: - """Updates the fabric. - - Performs update on the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param body: Fabric properties. Is either a FabricModelUpdate type or a IO type. Default value - is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either FabricModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FabricModel] = 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, - fabric_name=fabric_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FabricModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, fabric_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - @distributed_trace - def begin_delete(self, resource_group_name: str, fabric_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes the fabric. - - Removes the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - fabric_name=fabric_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" - } - - @distributed_trace - def list_by_subscription( - self, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.FabricModel"]: - """Lists the fabrics. - - Gets the list of fabrics in the given subscription. - - :param continuation_token_parameter: Continuation token from the previous call. Default value - is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FabricModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FabricModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FabricModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics" - } - - @distributed_trace - def list( - self, resource_group_name: str, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.FabricModel"]: - """Lists the fabrics. - - Gets the list of fabrics in the given subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param continuation_token_parameter: Continuation token from the previous call. Default value - is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FabricModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FabricModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FabricModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_fabric_operations_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_fabric_operations_status_operations.py deleted file mode 100644 index 549f599e9efc..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_fabric_operations_status_operations.py +++ /dev/null @@ -1,158 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, fabric_name: str, operation_id: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/operations/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class FabricOperationsStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`fabric_operations_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, fabric_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the fabric operation status. - - Tracks the results of an asynchronous operation on the fabric. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - fabric_name=fabric_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_operations.py index e7b985fd53b1..54c38479b8b6 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_operations.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_operations.py @@ -1,50 +1,1750 @@ -# pylint: disable=too-many-lines +# 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) AutoRest Code Generator. +# 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, Callable, Dict, Iterable, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +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.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request +from .._configuration import RecoveryServicesDataReplicationMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +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", "2021-02-16-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.DataReplication/operations") + _url = "/providers/Microsoft.DataReplication/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_email_configuration_get_request( + resource_group_name: str, vault_name: str, email_configuration_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "emailConfigurationName": _SERIALIZER.url("email_configuration_name", email_configuration_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_email_configuration_create_request( + resource_group_name: str, vault_name: str, email_configuration_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "emailConfigurationName": _SERIALIZER.url("email_configuration_name", email_configuration_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_email_configuration_list_request( + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_vault_get_request( + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_vault_create_request( + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_vault_update_request( + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_vault_delete_request( + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_vault_list_request( + resource_group_name: str, subscription_id: str, *, continuation_token_parameter: 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults" + 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") + if continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vault_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults" + 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_event_get_request( + resource_group_name: str, vault_name: str, event_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "eventName": _SERIALIZER.url("event_name", event_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_event_list_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + odata_options: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if odata_options is not None: + _params["odataOptions"] = _SERIALIZER.query("odata_options", odata_options, "str") + if continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fabric_get_request( + resource_group_name: str, fabric_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_fabric_create_request( + resource_group_name: str, fabric_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_fabric_update_request( + resource_group_name: str, fabric_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_fabric_delete_request( + resource_group_name: str, fabric_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_fabric_list_request( + resource_group_name: str, subscription_id: str, *, continuation_token_parameter: 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics" + 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") + if continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fabric_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics" + 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_fabric_agent_get_request( + resource_group_name: str, fabric_name: str, fabric_agent_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "fabricAgentName": _SERIALIZER.url("fabric_agent_name", fabric_agent_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_fabric_agent_create_request( + resource_group_name: str, fabric_name: str, fabric_agent_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "fabricAgentName": _SERIALIZER.url("fabric_agent_name", fabric_agent_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_fabric_agent_delete_request( + resource_group_name: str, fabric_name: str, fabric_agent_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "fabricAgentName": _SERIALIZER.url("fabric_agent_name", fabric_agent_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_fabric_agent_list_request( + resource_group_name: str, fabric_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_job_get_request( + resource_group_name: str, vault_name: str, job_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_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_job_list_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + odata_options: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if odata_options is not None: + _params["odataOptions"] = _SERIALIZER.query("odata_options", odata_options, "str") + if continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_policy_get_request( + resource_group_name: str, vault_name: str, policy_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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_policy_create_request( + resource_group_name: str, vault_name: str, policy_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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_policy_delete_request( + resource_group_name: str, vault_name: str, policy_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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_policy_list_request( + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_private_endpoint_connections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_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_private_endpoint_connections_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_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_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_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_private_endpoint_connections_list_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_private_endpoint_connection_proxies_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "privateEndpointConnectionProxyName": _SERIALIZER.url( + "private_endpoint_connection_proxy_name", private_endpoint_connection_proxy_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_private_endpoint_connection_proxies_create_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "privateEndpointConnectionProxyName": _SERIALIZER.url( + "private_endpoint_connection_proxy_name", private_endpoint_connection_proxy_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_private_endpoint_connection_proxies_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "privateEndpointConnectionProxyName": _SERIALIZER.url( + "private_endpoint_connection_proxy_name", private_endpoint_connection_proxy_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_private_endpoint_connection_proxies_list_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_private_endpoint_connection_proxies_validate_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}/validate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "privateEndpointConnectionProxyName": _SERIALIZER.url( + "private_endpoint_connection_proxy_name", private_endpoint_connection_proxy_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_private_link_resources_get_request( + resource_group_name: str, vault_name: str, private_link_resource_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateLinkResources/{privateLinkResourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_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_private_link_resources_list_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateLinkResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_protected_item_get_request( + resource_group_name: str, vault_name: str, protected_item_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_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_protected_item_create_request( + resource_group_name: str, vault_name: str, protected_item_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_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_protected_item_update_request( + resource_group_name: str, vault_name: str, protected_item_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_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_protected_item_delete_request( + resource_group_name: str, + vault_name: str, + protected_item_name: str, + subscription_id: str, + *, + force_delete: Optional[bool] = 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_delete is not None: + _params["forceDelete"] = _SERIALIZER.query("force_delete", force_delete, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_protected_item_list_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + odata_options: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if odata_options is not None: + _params["odataOptions"] = _SERIALIZER.query("odata_options", odata_options, "str") + if continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_protected_item_planned_failover_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, protected_item_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_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_recovery_point_get_request( + resource_group_name: str, + vault_name: str, + protected_item_name: str, + recovery_point_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + "recoveryPointName": _SERIALIZER.url("recovery_point_name", recovery_point_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_recovery_point_list_request( + resource_group_name: str, vault_name: str, protected_item_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_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_replication_extension_get_request( + resource_group_name: str, vault_name: str, replication_extension_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "replicationExtensionName": _SERIALIZER.url("replication_extension_name", replication_extension_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_replication_extension_create_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, replication_extension_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "replicationExtensionName": _SERIALIZER.url("replication_extension_name", replication_extension_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_replication_extension_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, replication_extension_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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "replicationExtensionName": _SERIALIZER.url("replication_extension_name", replication_extension_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_replication_extension_list_request( + resource_group_name: str, 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", 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_check_name_availability_post_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability" + ) + 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 + 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_deployment_preflight_post_request( + resource_group_name: str, deployment_id: 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentId": _SERIALIZER.url("deployment_id", deployment_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_operation_results_get_request( + resource_group_name: str, operation_id: 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/operationResults/{operationId}/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_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_location_based_operation_results_get_request( # pylint: disable=name-too-long + resource_group_name: str, location: str, operation_id: 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", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/locations/{location}/operationResults/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -60,39 +1760,6818 @@ class Operations: .. warning:: **DO NOT** instantiate this class directly. - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`operations` attribute. - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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.recoveryservicesdatareplication.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 EmailConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`email_configuration` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, email_configuration_name: str, **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Gets the details of the alert configuration setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :return: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :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.EmailConfigurationModel] = kwargs.pop("cls", None) + + _request = build_email_configuration_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + email_configuration_name=email_configuration_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.EmailConfigurationModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + vault_name: str, + email_configuration_name: str, + resource: _models.EmailConfigurationModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Creates an alert configuration setting for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :param resource: EmailConfiguration model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + vault_name: str, + email_configuration_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Creates an alert configuration setting for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :param resource: EmailConfiguration model. 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: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + vault_name: str, + email_configuration_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Creates an alert configuration setting for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :param resource: EmailConfiguration model. 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: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + vault_name: str, + email_configuration_name: str, + resource: Union[_models.EmailConfigurationModel, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.EmailConfigurationModel: + """Creates an alert configuration setting for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param email_configuration_name: The email configuration name. Required. + :type email_configuration_name: str + :param resource: EmailConfiguration model. Is one of the following types: + EmailConfigurationModel, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel or + JSON or IO[bytes] + :return: EmailConfigurationModel. The EmailConfigurationModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel + :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.EmailConfigurationModel] = 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_email_configuration_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + email_configuration_name=email_configuration_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 = 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, 201]: + 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.EmailConfigurationModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> Iterable["_models.EmailConfigurationModel"]: + """Gets the list of alert configuration settings for the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of EmailConfigurationModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.EmailConfigurationModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EmailConfigurationModel]] = 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_email_configuration_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.EmailConfigurationModel], 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 VaultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`vault` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, **kwargs: Any) -> _models.VaultModel: + """Gets the details of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: VaultModel. The VaultModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel + :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.VaultModel] = kwargs.pop("cls", None) + + _request = build_vault_get_request( + resource_group_name=resource_group_name, + vault_name=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.VaultModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + vault_name: str, + resource: Union[_models.VaultModel, 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_vault_create_request( + resource_group_name=resource_group_name, + vault_name=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, + vault_name: str, + resource: _models.VaultModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultModel]: + """Creates the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param resource: Vault properties. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel + :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 VaultModel. The VaultModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + vault_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultModel]: + """Creates the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param resource: Vault properties. 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 VaultModel. The VaultModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + vault_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultModel]: + """Creates the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param resource: Vault properties. 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 VaultModel. The VaultModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + vault_name: str, + resource: Union[_models.VaultModel, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VaultModel]: + """Creates the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param resource: Vault properties. Is one of the following types: VaultModel, JSON, IO[bytes] + Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel or JSON or + IO[bytes] + :return: An instance of LROPoller that returns VaultModel. The VaultModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :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.VaultModel] = 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, + vault_name=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.VaultModel, 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.VaultModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VaultModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + vault_name: str, + properties: Union[_models.VaultModelUpdate, 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_vault_update_request( + resource_group_name=resource_group_name, + vault_name=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, + vault_name: str, + properties: _models.VaultModelUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultModel]: + """Performs update on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param properties: Vault properties. Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdate + :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 VaultModel. The VaultModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vault_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultModel]: + """Performs update on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param properties: Vault properties. 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 VaultModel. The VaultModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vault_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultModel]: + """Performs update on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param properties: Vault properties. 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 VaultModel. The VaultModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vault_name: str, + properties: Union[_models.VaultModelUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VaultModel]: + """Performs update on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param properties: Vault properties. Is one of the following types: VaultModelUpdate, JSON, + IO[bytes] Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdate or JSON + or IO[bytes] + :return: An instance of LROPoller that returns VaultModel. The VaultModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :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.VaultModel] = 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, + vault_name=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.VaultModel, 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.VaultModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VaultModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, 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_vault_delete_request( + resource_group_name=resource_group_name, + vault_name=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 + def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> LROPoller[None]: + """Removes the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type 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, + vault_name=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 + def list( + self, resource_group_name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.VaultModel"]: + """Gets the list of vaults in the given subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword continuation_token_parameter: Continuation token from the previous call. Default value + is None. + :paramtype continuation_token_parameter: str + :return: An iterator like instance of VaultModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VaultModel]] = 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_vault_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + continuation_token_parameter=continuation_token_parameter, + 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.VaultModel], 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 + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VaultModel"]: + """Gets the list of vaults in the given subscription. + + :return: An iterator like instance of VaultModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VaultModel]] = 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_vault_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.VaultModel], 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 EventOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`event` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, event_name: str, **kwargs: Any) -> _models.EventModel: + """Gets the details of the event. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param event_name: The event name. Required. + :type event_name: str + :return: EventModel. The EventModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.EventModel + :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.EventModel] = kwargs.pop("cls", None) + + _request = build_event_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + event_name=event_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.EventModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + *, + odata_options: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EventModel"]: + """Gets the list of events in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :keyword odata_options: OData options. Default value is None. + :paramtype odata_options: str + :keyword continuation_token_parameter: Continuation token. Default value is None. + :paramtype continuation_token_parameter: str + :keyword page_size: Page size. Default value is None. + :paramtype page_size: int + :return: An iterator like instance of EventModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.EventModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EventModel]] = 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_event_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + odata_options=odata_options, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + 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.EventModel], 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 FabricOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`fabric` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, fabric_name: str, **kwargs: Any) -> _models.FabricModel: + """Gets the details of the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :return: FabricModel. The FabricModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel + :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.FabricModel] = kwargs.pop("cls", None) + + _request = build_fabric_get_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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.FabricModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + fabric_name: str, + resource: Union[_models.FabricModel, 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_fabric_create_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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, + fabric_name: str, + resource: _models.FabricModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FabricModel]: + """Creates the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param resource: Fabric properties. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel + :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 FabricModel. The FabricModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + fabric_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FabricModel]: + """Creates the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param resource: Fabric properties. 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 FabricModel. The FabricModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + fabric_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FabricModel]: + """Creates the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param resource: Fabric properties. 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 FabricModel. The FabricModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + fabric_name: str, + resource: Union[_models.FabricModel, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FabricModel]: + """Creates the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param resource: Fabric properties. Is one of the following types: FabricModel, JSON, IO[bytes] + Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModel or JSON or + IO[bytes] + :return: An instance of LROPoller that returns FabricModel. The FabricModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :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.FabricModel] = 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, + fabric_name=fabric_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.FabricModel, 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.FabricModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FabricModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + fabric_name: str, + properties: Union[_models.FabricModelUpdate, 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_fabric_update_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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, + fabric_name: str, + properties: _models.FabricModelUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FabricModel]: + """Performs update on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param properties: Fabric properties. Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdate + :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 FabricModel. The FabricModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + fabric_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FabricModel]: + """Performs update on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param properties: Fabric properties. 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 FabricModel. The FabricModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + fabric_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FabricModel]: + """Performs update on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param properties: Fabric properties. 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 FabricModel. The FabricModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + fabric_name: str, + properties: Union[_models.FabricModelUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FabricModel]: + """Performs update on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param properties: Fabric properties. Is one of the following types: FabricModelUpdate, JSON, + IO[bytes] Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.FabricModelUpdate or JSON + or IO[bytes] + :return: An instance of LROPoller that returns FabricModel. The FabricModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :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.FabricModel] = 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, + fabric_name=fabric_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.FabricModel, 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.FabricModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FabricModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, fabric_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_fabric_delete_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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 + def begin_delete(self, resource_group_name: str, fabric_name: str, **kwargs: Any) -> LROPoller[None]: + """Removes the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_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, + fabric_name=fabric_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 + def list( + self, resource_group_name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.FabricModel"]: + """Gets the list of fabrics in the given subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword continuation_token_parameter: Continuation token from the previous call. Default value + is None. + :paramtype continuation_token_parameter: str + :return: An iterator like instance of FabricModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FabricModel]] = 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_fabric_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + continuation_token_parameter=continuation_token_parameter, + 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.FabricModel], 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 + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.FabricModel"]: + """Gets the list of fabrics in the given subscription. + + :return: An iterator like instance of FabricModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FabricModel]] = 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_fabric_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.FabricModel], 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 FabricAgentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`fabric_agent` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, fabric_name: str, fabric_agent_name: str, **kwargs: Any + ) -> _models.FabricAgentModel: + """Gets the details of the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :return: FabricAgentModel. The FabricAgentModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel + :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.FabricAgentModel] = kwargs.pop("cls", None) + + _request = build_fabric_agent_get_request( + resource_group_name=resource_group_name, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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.FabricAgentModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + fabric_name: str, + fabric_agent_name: str, + resource: Union[_models.FabricAgentModel, 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_fabric_agent_create_request( + resource_group_name=resource_group_name, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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, + fabric_name: str, + fabric_agent_name: str, + resource: _models.FabricAgentModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FabricAgentModel]: + """Creates the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :param resource: Fabric agent model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel + :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 FabricAgentModel. The FabricAgentModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + fabric_name: str, + fabric_agent_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FabricAgentModel]: + """Creates the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :param resource: Fabric agent model. 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 FabricAgentModel. The FabricAgentModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + fabric_name: str, + fabric_agent_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FabricAgentModel]: + """Creates the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :param resource: Fabric agent model. 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 FabricAgentModel. The FabricAgentModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + fabric_name: str, + fabric_agent_name: str, + resource: Union[_models.FabricAgentModel, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FabricAgentModel]: + """Creates the fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_name: str + :param resource: Fabric agent model. Is one of the following types: FabricAgentModel, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel or JSON or + IO[bytes] + :return: An instance of LROPoller that returns FabricAgentModel. The FabricAgentModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :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.FabricAgentModel] = 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, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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.FabricAgentModel, 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.FabricAgentModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FabricAgentModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, fabric_name: str, fabric_agent_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_fabric_agent_delete_request( + resource_group_name=resource_group_name, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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 + def begin_delete( + self, resource_group_name: str, fabric_name: str, fabric_agent_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes fabric agent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :param fabric_agent_name: The fabric agent name. Required. + :type fabric_agent_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, + fabric_name=fabric_name, + fabric_agent_name=fabric_agent_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 + def list(self, resource_group_name: str, fabric_name: str, **kwargs: Any) -> Iterable["_models.FabricAgentModel"]: + """Gets the list of fabric agents in the given fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fabric_name: The fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of FabricAgentModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.FabricAgentModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FabricAgentModel]] = 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_fabric_agent_list_request( + resource_group_name=resource_group_name, + fabric_name=fabric_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.FabricAgentModel], 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 JobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`job` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, job_name: str, **kwargs: Any) -> _models.JobModel: + """Gets the details of the job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param job_name: The job name. Required. + :type job_name: str + :return: JobModel. The JobModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.JobModel + :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.JobModel] = kwargs.pop("cls", None) + + _request = build_job_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + job_name=job_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.JobModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + *, + odata_options: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.JobModel"]: + """Gets the list of jobs in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :keyword odata_options: OData options. Default value is None. + :paramtype odata_options: str + :keyword continuation_token_parameter: Continuation token. Default value is None. + :paramtype continuation_token_parameter: str + :keyword page_size: Page size. Default value is None. + :paramtype page_size: int + :return: An iterator like instance of JobModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.JobModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobModel]] = 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_job_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + odata_options=odata_options, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + 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.JobModel], 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 PolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`policy` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, policy_name: str, **kwargs: Any) -> _models.PolicyModel: + """Gets the details of the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :return: PolicyModel. The PolicyModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel + :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.PolicyModel] = kwargs.pop("cls", None) + + _request = build_policy_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + policy_name=policy_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.PolicyModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + vault_name: str, + policy_name: str, + resource: Union[_models.PolicyModel, 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_policy_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + policy_name=policy_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, + vault_name: str, + policy_name: str, + resource: _models.PolicyModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PolicyModel]: + """Creates the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :param resource: Policy model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel + :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 PolicyModel. The PolicyModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + vault_name: str, + policy_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PolicyModel]: + """Creates the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :param resource: Policy model. 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 PolicyModel. The PolicyModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + vault_name: str, + policy_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PolicyModel]: + """Creates the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :param resource: Policy model. 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 PolicyModel. The PolicyModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + vault_name: str, + policy_name: str, + resource: Union[_models.PolicyModel, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PolicyModel]: + """Creates the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_name: str + :param resource: Policy model. Is one of the following types: PolicyModel, JSON, IO[bytes] + Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel or JSON or + IO[bytes] + :return: An instance of LROPoller that returns PolicyModel. The PolicyModel is compatible with + MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :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.PolicyModel] = 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, + vault_name=vault_name, + policy_name=policy_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.PolicyModel, 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.PolicyModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PolicyModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, vault_name: str, policy_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_policy_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + policy_name=policy_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 + def begin_delete( + self, resource_group_name: str, vault_name: str, policy_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Removes the policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param policy_name: The policy name. Required. + :type policy_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, + vault_name=vault_name, + policy_name=policy_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 + def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iterable["_models.PolicyModel"]: + """Gets the list of policies in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of PolicyModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PolicyModel]] = 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_policy_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.PolicyModel], 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 PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`private_endpoint_connections` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the private endpoint connection details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :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.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_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.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updated the private endpoint connection status (Approval/Rejected). This gets invoked by + resource admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param resource: Private endpoint connection update input. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updated the private endpoint connection status (Approval/Rejected). This gets invoked by + resource admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param resource: Private endpoint connection update input. 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: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updated the private endpoint connection status (Approval/Rejected). This gets invoked by + resource admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param resource: Private endpoint connection update input. 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: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updated the private endpoint connection status (Approval/Rejected). This gets invoked by + resource admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param resource: Private endpoint connection update input. Is one of the following types: + PrivateEndpointConnection, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection or + JSON or IO[bytes] + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection + :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.PrivateEndpointConnection] = 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_private_endpoint_connections_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_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 = 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, 201]: + 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.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_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_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_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 + def begin_delete( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_name: The private endpoint connection name. Required. + :type private_endpoint_connection_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, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_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 + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """Gets the all private endpoint connections configured on the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = 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_private_endpoint_connections_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.PrivateEndpointConnection], 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 PrivateEndpointConnectionProxiesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`private_endpoint_connection_proxies` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, private_endpoint_connection_proxy_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Gets the private endpoint connection proxy details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :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.PrivateEndpointConnectionProxy] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connection_proxies_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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.PrivateEndpointConnectionProxy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + resource: _models.PrivateEndpointConnectionProxy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Create a new private endpoint connection proxy which includes both auto and manual approval + types. Creating the proxy resource will also create a private endpoint connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param resource: Private endpoint connection creation input. Required. + :type resource: + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Create a new private endpoint connection proxy which includes both auto and manual approval + types. Creating the proxy resource will also create a private endpoint connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param resource: Private endpoint connection creation input. 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: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Create a new private endpoint connection proxy which includes both auto and manual approval + types. Creating the proxy resource will also create a private endpoint connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param resource: Private endpoint connection creation input. 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: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + resource: Union[_models.PrivateEndpointConnectionProxy, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Create a new private endpoint connection proxy which includes both auto and manual approval + types. Creating the proxy resource will also create a private endpoint connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param resource: Private endpoint connection creation input. Is one of the following types: + PrivateEndpointConnectionProxy, JSON, IO[bytes] Required. + :type resource: + ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy or JSON or + IO[bytes] + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :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.PrivateEndpointConnectionProxy] = 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_private_endpoint_connection_proxies_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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 = 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, 201]: + 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.PrivateEndpointConnectionProxy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_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_private_endpoint_connection_proxies_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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 + def begin_delete( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_proxy_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Returns the operation to track the deletion of private endpoint connection proxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_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, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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 + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionProxy"]: + """Gets the all private endpoint connections proxies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of PrivateEndpointConnectionProxy + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnectionProxy]] = 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_private_endpoint_connection_proxies_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.PrivateEndpointConnectionProxy], 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) + + @overload + def validate( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + body: _models.PrivateEndpointConnectionProxy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Returns remote private endpoint connection information after validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param body: The private endpoint connection proxy input. Required. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Returns remote private endpoint connection information after validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param body: The private endpoint connection proxy input. 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: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Returns remote private endpoint connection information after validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param body: The private endpoint connection proxy input. 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: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_proxy_name: str, + body: Union[_models.PrivateEndpointConnectionProxy, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnectionProxy: + """Returns remote private endpoint connection information after validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_endpoint_connection_proxy_name: The private endpoint connection proxy name. + Required. + :type private_endpoint_connection_proxy_name: str + :param body: The private endpoint connection proxy input. Is one of the following types: + PrivateEndpointConnectionProxy, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + or JSON or IO[bytes] + :return: PrivateEndpointConnectionProxy. The PrivateEndpointConnectionProxy is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateEndpointConnectionProxy + :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.PrivateEndpointConnectionProxy] = 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_private_endpoint_connection_proxies_validate_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_proxy_name=private_endpoint_connection_proxy_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 = 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.PrivateEndpointConnectionProxy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`private_link_resources` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, private_link_resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the details of site recovery private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param private_link_resource_name: The private link name. Required. + :type private_link_resource_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkResource + :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.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_private_link_resources_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_link_resource_name=private_link_resource_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.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iterable["_models.PrivateLinkResource"]: + """Gets the list of private link resources. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = 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_private_link_resources_list_request( + resource_group_name=resource_group_name, + vault_name=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) + + 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.PrivateLinkResource], 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 ProtectedItemOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`protected_item` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, protected_item_name: str, **kwargs: Any + ) -> _models.ProtectedItemModel: + """Gets the details of the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :return: ProtectedItemModel. The ProtectedItemModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel + :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.ProtectedItemModel] = kwargs.pop("cls", None) + + _request = build_protected_item_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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.ProtectedItemModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + resource: Union[_models.ProtectedItemModel, 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_protected_item_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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, + vault_name: str, + protected_item_name: str, + resource: _models.ProtectedItemModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectedItemModel]: + """Creates the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param resource: Protected item model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel + :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 ProtectedItemModel. The ProtectedItemModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectedItemModel]: + """Creates the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param resource: Protected item model. 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 ProtectedItemModel. The ProtectedItemModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectedItemModel]: + """Creates the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param resource: Protected item model. 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 ProtectedItemModel. The ProtectedItemModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + resource: Union[_models.ProtectedItemModel, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ProtectedItemModel]: + """Creates the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param resource: Protected item model. Is one of the following types: ProtectedItemModel, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel or JSON + or IO[bytes] + :return: An instance of LROPoller that returns ProtectedItemModel. The ProtectedItemModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :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.ProtectedItemModel] = 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, + vault_name=vault_name, + protected_item_name=protected_item_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.ProtectedItemModel, 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.ProtectedItemModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ProtectedItemModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + properties: Union[_models.ProtectedItemModelUpdate, 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_protected_item_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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, + vault_name: str, + protected_item_name: str, + properties: _models.ProtectedItemModelUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectedItemModel]: + """Performs update on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param properties: Protected item model. Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelUpdate + :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 ProtectedItemModel. The ProtectedItemModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectedItemModel]: + """Performs update on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param properties: Protected item model. 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 ProtectedItemModel. The ProtectedItemModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectedItemModel]: + """Performs update on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param properties: Protected item model. 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 ProtectedItemModel. The ProtectedItemModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + properties: Union[_models.ProtectedItemModelUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ProtectedItemModel]: + """Performs update on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param properties: Protected item model. Is one of the following types: + ProtectedItemModelUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModelUpdate + or JSON or IO[bytes] + :return: An instance of LROPoller that returns ProtectedItemModel. The ProtectedItemModel is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :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.ProtectedItemModel] = 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, + vault_name=vault_name, + protected_item_name=protected_item_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.ProtectedItemModel, 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.ProtectedItemModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ProtectedItemModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + *, + force_delete: Optional[bool] = None, + **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_protected_item_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, + force_delete=force_delete, + 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, + vault_name: str, + protected_item_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Removes the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :keyword force_delete: A flag indicating whether to do force delete or not. Default value is + None. + :paramtype force_delete: bool + :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, + vault_name=vault_name, + protected_item_name=protected_item_name, + force_delete=force_delete, + 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( + self, + resource_group_name: str, + vault_name: str, + *, + odata_options: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ProtectedItemModel"]: + """Gets the list of protected items in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :keyword odata_options: OData options. Default value is None. + :paramtype odata_options: str + :keyword continuation_token_parameter: Continuation token. Default value is None. + :paramtype continuation_token_parameter: str + :keyword page_size: Page size. Default value is None. + :paramtype page_size: int + :return: An iterator like instance of ProtectedItemModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectedItemModel]] = 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_protected_item_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + odata_options=odata_options, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + 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.ProtectedItemModel], 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 _planned_failover_initial( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: Union[_models.PlannedFailoverModel, 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_protected_item_planned_failover_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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_planned_failover( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: _models.PlannedFailoverModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PlannedFailoverModel]: + """Performs the planned failover on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param body: Planned failover model. Required. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel + :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 PlannedFailoverModel. The PlannedFailoverModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_planned_failover( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PlannedFailoverModel]: + """Performs the planned failover on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param body: Planned failover model. 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 PlannedFailoverModel. The PlannedFailoverModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_planned_failover( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PlannedFailoverModel]: + """Performs the planned failover on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param body: Planned failover model. 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 PlannedFailoverModel. The PlannedFailoverModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_planned_failover( + self, + resource_group_name: str, + vault_name: str, + protected_item_name: str, + body: Union[_models.PlannedFailoverModel, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PlannedFailoverModel]: + """Performs the planned failover on the protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param body: Planned failover model. Is one of the following types: PlannedFailoverModel, JSON, + IO[bytes] Required. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel or JSON or + IO[bytes] + :return: An instance of LROPoller that returns PlannedFailoverModel. The PlannedFailoverModel + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] + :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.PlannedFailoverModel] = 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._planned_failover_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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.PlannedFailoverModel, 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.PlannedFailoverModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PlannedFailoverModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class RecoveryPointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`recovery_point` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, + vault_name: str, + protected_item_name: str, + recovery_point_name: str, + **kwargs: Any + ) -> _models.RecoveryPointModel: + """Gets the details of the recovery point of a protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :param recovery_point_name: The recovery point name. Required. + :type recovery_point_name: str + :return: RecoveryPointModel. The RecoveryPointModel is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel + :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.RecoveryPointModel] = kwargs.pop("cls", None) + + _request = build_recovery_point_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_name, + recovery_point_name=recovery_point_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.RecoveryPointModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, protected_item_name: str, **kwargs: Any + ) -> Iterable["_models.RecoveryPointModel"]: + """Gets the list of recovery points of the given protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param protected_item_name: The protected item name. Required. + :type protected_item_name: str + :return: An iterator like instance of RecoveryPointModel + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryPointModel]] = 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_recovery_point_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + protected_item_name=protected_item_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.RecoveryPointModel], 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 ReplicationExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`replication_extension` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, vault_name: str, replication_extension_name: str, **kwargs: Any + ) -> _models.ReplicationExtensionModel: + """Gets the details of the replication extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :return: ReplicationExtensionModel. The ReplicationExtensionModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel + :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.ReplicationExtensionModel] = kwargs.pop("cls", None) + + _request = build_replication_extension_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + replication_extension_name=replication_extension_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.ReplicationExtensionModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + vault_name: str, + replication_extension_name: str, + resource: Union[_models.ReplicationExtensionModel, 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 {} - models = _models + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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_replication_extension_create_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + replication_extension_name=replication_extension_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, + vault_name: str, + replication_extension_name: str, + resource: _models.ReplicationExtensionModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationExtensionModel]: + """Creates the replication extension in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :param resource: Replication extension model. Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel + :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 ReplicationExtensionModel. The + ReplicationExtensionModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + vault_name: str, + replication_extension_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationExtensionModel]: + """Creates the replication extension in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :param resource: Replication extension model. 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 ReplicationExtensionModel. The + ReplicationExtensionModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + vault_name: str, + replication_extension_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationExtensionModel]: + """Creates the replication extension in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :param resource: Replication extension model. 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 ReplicationExtensionModel. The + ReplicationExtensionModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """Get a list of REST API operations supported by Microsoft.DataReplication. + def begin_create( + self, + resource_group_name: str, + vault_name: str, + replication_extension_name: str, + resource: Union[_models.ReplicationExtensionModel, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationExtensionModel]: + """Creates the replication extension in the given vault. - Gets the operations. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_name: str + :param resource: Replication extension model. Is one of the following types: + ReplicationExtensionModel, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel or + JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationExtensionModel. The + ReplicationExtensionModel is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] + :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.ReplicationExtensionModel] = 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, + vault_name=vault_name, + replication_extension_name=replication_extension_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.ReplicationExtensionModel, 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.ReplicationExtensionModel].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationExtensionModel]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, vault_name: str, replication_extension_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_replication_extension_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + replication_extension_name=replication_extension_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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Operation or the result of cls(response) + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, vault_name: str, replication_extension_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the replication extension in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :param replication_extension_name: The replication extension name. Required. + :type replication_extension_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, + vault_name=vault_name, + replication_extension_name=replication_extension_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 + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> Iterable["_models.ReplicationExtensionModel"]: + """Gets the list of replication extensions in the given vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The vault name. Required. + :type vault_name: str + :return: An iterator like instance of ReplicationExtensionModel :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.Operation] + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ReplicationExtensionModel]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,14 +8582,20 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], + _request = build_replication_extension_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + 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 @@ -122,37 +8607,595 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + 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 = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ReplicationExtensionModel], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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) - list.metadata = {"url": "/providers/Microsoft.DataReplication/operations"} + +class CheckNameAvailabilityOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`check_name_availability` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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") + + @overload + def post( + self, + location: str, + body: Optional[_models.CheckNameAvailabilityModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseModel: + """Performs the resource name availability check. + + Checks the resource name availability. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: Resource details. Default value is None. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResponseModel. The CheckNameAvailabilityResponseModel is + compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, location: str, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseModel: + """Performs the resource name availability check. + + Checks the resource name availability. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: Resource details. Default value is None. + :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: CheckNameAvailabilityResponseModel. The CheckNameAvailabilityResponseModel is + compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, location: str, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseModel: + """Performs the resource name availability check. + + Checks the resource name availability. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: Resource details. Default value is None. + :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: CheckNameAvailabilityResponseModel. The CheckNameAvailabilityResponseModel is + compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + location: str, + body: Optional[Union[_models.CheckNameAvailabilityModel, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseModel: + """Performs the resource name availability check. + + Checks the resource name availability. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: Resource details. Is one of the following types: CheckNameAvailabilityModel, JSON, + IO[bytes] Default value is None. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityModel or + JSON or IO[bytes] + :return: CheckNameAvailabilityResponseModel. The CheckNameAvailabilityResponseModel is + compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel + :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.CheckNameAvailabilityResponseModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_check_name_availability_post_request( + location=location, + 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.CheckNameAvailabilityResponseModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DeploymentPreflightOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`deployment_preflight` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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") + + @overload + def post( + self, + resource_group_name: str, + deployment_id: str, + body: Optional[_models.DeploymentPreflightModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeploymentPreflightModel: + """Performs resource deployment validation. + + Performs resource deployment preflight validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_id: Deployment Id. Required. + :type deployment_id: str + :param body: Deployment preflight model. Default value is None. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DeploymentPreflightModel. The DeploymentPreflightModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + deployment_id: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeploymentPreflightModel: + """Performs resource deployment validation. + + Performs resource deployment preflight validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_id: Deployment Id. Required. + :type deployment_id: str + :param body: Deployment preflight model. Default value is None. + :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: DeploymentPreflightModel. The DeploymentPreflightModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + deployment_id: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeploymentPreflightModel: + """Performs resource deployment validation. + + Performs resource deployment preflight validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_id: Deployment Id. Required. + :type deployment_id: str + :param body: Deployment preflight model. Default value is None. + :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: DeploymentPreflightModel. The DeploymentPreflightModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + deployment_id: str, + body: Optional[Union[_models.DeploymentPreflightModel, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DeploymentPreflightModel: + """Performs resource deployment validation. + + Performs resource deployment preflight validation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_id: Deployment Id. Required. + :type deployment_id: str + :param body: Deployment preflight model. Is one of the following types: + DeploymentPreflightModel, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel or JSON + or IO[bytes] + :return: DeploymentPreflightModel. The DeploymentPreflightModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel + :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.DeploymentPreflightModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_deployment_preflight_post_request( + resource_group_name=resource_group_name, + deployment_id=deployment_id, + 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.DeploymentPreflightModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`operation_results` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, operation_id: str, **kwargs: Any) -> _models.OperationStatus: + """Gets the operation result status. + + Gets the operations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :return: OperationStatus. The OperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus + :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.OperationStatus] = kwargs.pop("cls", None) + + _request = build_operation_results_get_request( + resource_group_name=resource_group_name, + operation_id=operation_id, + 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.OperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class LocationBasedOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s + :attr:`location_based_operation_results` 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: RecoveryServicesDataReplicationMgmtClientConfiguration = ( + 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, location: str, operation_id: str, **kwargs: Any) -> _models.OperationStatus: + """Gets the location based operation result status. + + Gets the location based operation result. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :return: OperationStatus. The OperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus + :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.OperationStatus] = kwargs.pop("cls", None) + + _request = build_location_based_operation_results_get_request( + resource_group_name=resource_group_name, + location=location, + operation_id=operation_id, + 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.OperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_patch.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_patch.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_policy_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_policy_operation_status_operations.py deleted file mode 100644 index 2e2de6cb0936..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_policy_operation_status_operations.py +++ /dev/null @@ -1,162 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_name: str, policy_name: str, operation_id: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "policyName": _SERIALIZER.url("policy_name", policy_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PolicyOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`policy_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, policy_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the policy operation status. - - Tracks the results of an asynchronous operation on the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_policy_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_policy_operations.py deleted file mode 100644 index 2ecd6317a684..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_policy_operations.py +++ /dev/null @@ -1,736 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_name: str, policy_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "policyName": _SERIALIZER.url("policy_name", policy_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, vault_name: str, policy_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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "policyName": _SERIALIZER.url("policy_name", policy_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, vault_name: str, policy_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "policyName": _SERIALIZER.url("policy_name", policy_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _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 PolicyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`policy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, vault_name: str, policy_name: str, **kwargs: Any) -> _models.PolicyModel: - """Gets the policy. - - Gets the details of the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PolicyModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PolicyModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PolicyModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - def _create_initial( - self, - resource_group_name: str, - vault_name: str, - policy_name: str, - body: Optional[Union[_models.PolicyModel, IO]] = None, - **kwargs: Any - ) -> _models.PolicyModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PolicyModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "PolicyModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PolicyModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PolicyModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - vault_name: str, - policy_name: str, - body: Optional[_models.PolicyModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PolicyModel]: - """Puts the policy. - - Creates the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :param body: Policy model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PolicyModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - vault_name: str, - policy_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PolicyModel]: - """Puts the policy. - - Creates the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :param body: Policy model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PolicyModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - vault_name: str, - policy_name: str, - body: Optional[Union[_models.PolicyModel, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.PolicyModel]: - """Puts the policy. - - Creates the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :param body: Policy model. Is either a PolicyModel type or a IO type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PolicyModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PolicyModel] = 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, - vault_name=vault_name, - policy_name=policy_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PolicyModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, policy_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, vault_name: str, policy_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the policy. - - Removes the policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param policy_name: The policy name. Required. - :type policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - policy_name=policy_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" - } - - @distributed_trace - def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iterable["_models.PolicyModel"]: - """Lists the policies. - - Gets the list of policies in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PolicyModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.PolicyModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PolicyModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PolicyModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_protected_item_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_protected_item_operation_status_operations.py deleted file mode 100644 index c87381ee4525..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_protected_item_operation_status_operations.py +++ /dev/null @@ -1,169 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - vault_name: str, - protected_item_name: str, - operation_id: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/operations/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "protectedItemName": _SERIALIZER.url( - "protected_item_name", protected_item_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ProtectedItemOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`protected_item_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, protected_item_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the protected item operation status. - - Tracks the results of an asynchronous operation on the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_protected_item_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_protected_item_operations.py deleted file mode 100644 index ad8e23a236aa..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_protected_item_operations.py +++ /dev/null @@ -1,1064 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_name: str, protected_item_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "protectedItemName": _SERIALIZER.url( - "protected_item_name", protected_item_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, vault_name: str, protected_item_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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "protectedItemName": _SERIALIZER.url( - "protected_item_name", protected_item_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - vault_name: str, - protected_item_name: str, - subscription_id: str, - *, - force_delete: Optional[bool] = 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "protectedItemName": _SERIALIZER.url( - "protected_item_name", protected_item_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if force_delete is not None: - _params["forceDelete"] = _SERIALIZER.query("force_delete", force_delete, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _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_planned_failover_request( - resource_group_name: str, vault_name: str, protected_item_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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "protectedItemName": _SERIALIZER.url( - "protected_item_name", protected_item_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ProtectedItemOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`protected_item` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, protected_item_name: str, **kwargs: Any - ) -> _models.ProtectedItemModel: - """Gets the protected item. - - Gets the details of the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectedItemModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ProtectedItemModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProtectedItemModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - def _create_initial( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[Union[_models.ProtectedItemModel, IO]] = None, - **kwargs: Any - ) -> _models.ProtectedItemModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProtectedItemModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ProtectedItemModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ProtectedItemModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProtectedItemModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[_models.ProtectedItemModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectedItemModel]: - """Puts the protected item. - - Creates the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Protected item model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ProtectedItemModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectedItemModel]: - """Puts the protected item. - - Creates the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Protected item model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ProtectedItemModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[Union[_models.ProtectedItemModel, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.ProtectedItemModel]: - """Puts the protected item. - - Creates the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Protected item model. Is either a ProtectedItemModel type or a IO type. Default - value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ProtectedItemModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProtectedItemModel] = 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, - vault_name=vault_name, - protected_item_name=protected_item_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ProtectedItemModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - force_delete: Optional[bool] = None, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - force_delete=force_delete, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - force_delete: Optional[bool] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes the protected item. - - Removes the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param force_delete: A flag indicating whether to do force delete or not. Default value is - None. - :type force_delete: bool - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - force_delete=force_delete, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" - } - - @distributed_trace - def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iterable["_models.ProtectedItemModel"]: - """Lists the protected items. - - Gets the list of protected items in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectedItemModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.ProtectedItemModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ProtectedItemModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ProtectedItemModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems" - } - - def _planned_failover_initial( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[Union[_models.PlannedFailoverModel, IO]] = None, - **kwargs: Any - ) -> Optional[_models.PlannedFailoverModel]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PlannedFailoverModel]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "PlannedFailoverModel") - else: - _json = None - - request = build_planned_failover_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._planned_failover_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("PlannedFailoverModel", pipeline_response) - - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _planned_failover_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" - } - - @overload - def begin_planned_failover( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[_models.PlannedFailoverModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PlannedFailoverModel]: - """Performs planned failover. - - Performs the planned failover on the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Planned failover model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PlannedFailoverModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_planned_failover( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PlannedFailoverModel]: - """Performs planned failover. - - Performs the planned failover on the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Planned failover model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PlannedFailoverModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_planned_failover( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - body: Optional[Union[_models.PlannedFailoverModel, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.PlannedFailoverModel]: - """Performs planned failover. - - Performs the planned failover on the protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param body: Planned failover model. Is either a PlannedFailoverModel type or a IO type. - Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PlannedFailoverModel or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.PlannedFailoverModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PlannedFailoverModel] = 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._planned_failover_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PlannedFailoverModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_planned_failover.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_recovery_points_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_recovery_points_operations.py deleted file mode 100644 index 5bd051045b4c..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_recovery_points_operations.py +++ /dev/null @@ -1,312 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - vault_name: str, - protected_item_name: str, - recovery_point_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "protectedItemName": _SERIALIZER.url( - "protected_item_name", protected_item_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - "recoveryPointName": _SERIALIZER.url( - "recovery_point_name", recovery_point_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, vault_name: str, protected_item_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "protectedItemName": _SERIALIZER.url( - "protected_item_name", protected_item_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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 RecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`recovery_points` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, - resource_group_name: str, - vault_name: str, - protected_item_name: str, - recovery_point_name: str, - **kwargs: Any - ) -> _models.RecoveryPointModel: - """Gets the recovery point. - - Gets the details of the recovery point of a protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :param recovery_point_name: The recovery point name. Required. - :type recovery_point_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryPointModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.RecoveryPointModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - recovery_point_name=recovery_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecoveryPointModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, protected_item_name: str, **kwargs: Any - ) -> Iterable["_models.RecoveryPointModel"]: - """Lists the recovery points. - - Gets the list of recovery points of the given protected item. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param protected_item_name: The protected item name. Required. - :type protected_item_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.RecoveryPointModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.RecoveryPointModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - protected_item_name=protected_item_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RecoveryPointModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_recovery_services_data_replication_mgmt_client_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_recovery_services_data_replication_mgmt_client_operations.py deleted file mode 100644 index ccb1b619145a..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_recovery_services_data_replication_mgmt_client_operations.py +++ /dev/null @@ -1,387 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - 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_deployment_preflight_request( - resource_group_name: str, deployment_id: 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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentId": _SERIALIZER.url("deployment_id", deployment_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) - - -class RecoveryServicesDataReplicationMgmtClientOperationsMixin(RecoveryServicesDataReplicationMgmtClientMixinABC): - @overload - def check_name_availability( - self, - location: str, - body: Optional[_models.CheckNameAvailabilityModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseModel: - """Performs the resource name availability check. - - Checks the resource name availability. - - :param location: The name of the Azure region. Required. - :type location: str - :param body: Resource details. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, location: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseModel: - """Performs the resource name availability check. - - Checks the resource name availability. - - :param location: The name of the Azure region. Required. - :type location: str - :param body: Resource details. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, location: str, body: Optional[Union[_models.CheckNameAvailabilityModel, IO]] = None, **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseModel: - """Performs the resource name availability check. - - Checks the resource name availability. - - :param location: The name of the Azure region. Required. - :type location: str - :param body: Resource details. Is either a CheckNameAvailabilityModel type or a IO type. - Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.CheckNameAvailabilityResponseModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResponseModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "CheckNameAvailabilityModel") - else: - _json = None - - request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.check_name_availability.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResponseModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability" - } - - @overload - def deployment_preflight( - self, - resource_group_name: str, - deployment_id: str, - body: Optional[_models.DeploymentPreflightModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DeploymentPreflightModel: - """Performs resource deployment validation. - - Performs resource deployment validation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_id: Deployment Id. Required. - :type deployment_id: str - :param body: Deployment preflight model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentPreflightModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def deployment_preflight( - self, - resource_group_name: str, - deployment_id: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DeploymentPreflightModel: - """Performs resource deployment validation. - - Performs resource deployment validation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_id: Deployment Id. Required. - :type deployment_id: str - :param body: Deployment preflight model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentPreflightModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def deployment_preflight( - self, - resource_group_name: str, - deployment_id: str, - body: Optional[Union[_models.DeploymentPreflightModel, IO]] = None, - **kwargs: Any - ) -> _models.DeploymentPreflightModel: - """Performs resource deployment validation. - - Performs resource deployment validation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_id: Deployment Id. Required. - :type deployment_id: str - :param body: Deployment preflight model. Is either a DeploymentPreflightModel type or a IO - type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentPreflightModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.DeploymentPreflightModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentPreflightModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "DeploymentPreflightModel") - else: - _json = None - - request = build_deployment_preflight_request( - resource_group_name=resource_group_name, - deployment_id=deployment_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.deployment_preflight.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeploymentPreflightModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - deployment_preflight.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_replication_extension_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_replication_extension_operation_status_operations.py deleted file mode 100644 index 1aad3a654dec..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_replication_extension_operation_status_operations.py +++ /dev/null @@ -1,174 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - operation_id: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "replicationExtensionName": _SERIALIZER.url( - "replication_extension_name", replication_extension_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ReplicationExtensionOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`replication_extension_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - operation_id: str, - **kwargs: Any - ) -> _models.OperationStatus: - """Gets the replication extension operation status. - - Tracks the results of an asynchronous operation on the replication extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_replication_extension_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_replication_extension_operations.py deleted file mode 100644 index 9cfb530c121f..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_replication_extension_operations.py +++ /dev/null @@ -1,748 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_name: str, replication_extension_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "replicationExtensionName": _SERIALIZER.url( - "replication_extension_name", replication_extension_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, vault_name: str, replication_extension_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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "replicationExtensionName": _SERIALIZER.url( - "replication_extension_name", replication_extension_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, vault_name: str, replication_extension_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "replicationExtensionName": _SERIALIZER.url( - "replication_extension_name", replication_extension_name, "str", pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _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 ReplicationExtensionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`replication_extension` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, replication_extension_name: str, **kwargs: Any - ) -> _models.ReplicationExtensionModel: - """Gets the replication extension. - - Gets the details of the replication extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationExtensionModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ReplicationExtensionModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ReplicationExtensionModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - def _create_initial( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - body: Optional[Union[_models.ReplicationExtensionModel, IO]] = None, - **kwargs: Any - ) -> _models.ReplicationExtensionModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ReplicationExtensionModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ReplicationExtensionModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ReplicationExtensionModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ReplicationExtensionModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - body: Optional[_models.ReplicationExtensionModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationExtensionModel]: - """Puts the replication extension. - - Creates the replication extension in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :param body: Replication extension model. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationExtensionModel or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationExtensionModel]: - """Puts the replication extension. - - Creates the replication extension in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :param body: Replication extension model. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationExtensionModel or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - vault_name: str, - replication_extension_name: str, - body: Optional[Union[_models.ReplicationExtensionModel, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.ReplicationExtensionModel]: - """Puts the replication extension. - - Creates the replication extension in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :param body: Replication extension model. Is either a ReplicationExtensionModel type or a IO - type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationExtensionModel or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ReplicationExtensionModel] = 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, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ReplicationExtensionModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, replication_extension_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, vault_name: str, replication_extension_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the replication extension. - - Deletes the replication extension in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param replication_extension_name: The replication extension name. Required. - :type replication_extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - replication_extension_name=replication_extension_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.ReplicationExtensionModel"]: - """Lists the replication extensions. - - Gets the list of replication extensions in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationExtensionModel or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.ReplicationExtensionModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ReplicationExtensionModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ReplicationExtensionModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_vault_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_vault_operation_status_operations.py deleted file mode 100644 index c6185658985f..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_vault_operation_status_operations.py +++ /dev/null @@ -1,158 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_name: str, operation_id: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/operations/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VaultOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`vault_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the vault operation status. - - Tracks the results of an asynchronous operation on the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_vault_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_vault_operations.py deleted file mode 100644 index ae142ce05e4c..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_vault_operations.py +++ /dev/null @@ -1,1111 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request(resource_group_name: str, 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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request(resource_group_name: str, 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", "2021-02-16-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request(resource_group_name: str, 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request( - subscription_id: str, *, continuation_token_parameter: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, subscription_id: str, *, continuation_token_parameter: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) - _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 VaultOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`vault` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _models.VaultModel: - """Gets the vault. - - Gets the details of the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VaultModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - def _create_initial( - self, - resource_group_name: str, - vault_name: str, - body: Optional[Union[_models.VaultModel, IO]] = None, - **kwargs: Any - ) -> _models.VaultModel: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VaultModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "VaultModel") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("VaultModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - vault_name: str, - body: Optional[_models.VaultModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VaultModel]: - """Puts the vault. - - Creates the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VaultModel or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - vault_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VaultModel]: - """Puts the vault. - - Creates the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VaultModel or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - vault_name: str, - body: Optional[Union[_models.VaultModel, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.VaultModel]: - """Puts the vault. - - Creates the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Is either a VaultModel type or a IO type. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VaultModel or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VaultModel] = 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, - vault_name=vault_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VaultModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - def _update_initial( - self, - resource_group_name: str, - vault_name: str, - body: Optional[Union[_models.VaultModelUpdate, IO]] = None, - **kwargs: Any - ) -> Optional[_models.VaultModel]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VaultModel]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "VaultModelUpdate") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("VaultModel", pipeline_response) - - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - vault_name: str, - body: Optional[_models.VaultModelUpdate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VaultModel]: - """Updates the vault. - - Performs update on the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Default value is None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VaultModel or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vault_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VaultModel]: - """Updates the vault. - - Performs update on the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VaultModel or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vault_name: str, - body: Optional[Union[_models.VaultModelUpdate, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.VaultModel]: - """Updates the vault. - - Performs update on the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param body: Vault properties. Is either a VaultModelUpdate type or a IO type. Default value is - None. - :type body: ~azure.mgmt.recoveryservicesdatareplication.models.VaultModelUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VaultModel or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VaultModel] = 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, - vault_name=vault_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VaultModel", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - @distributed_trace - def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes the vault. - - Removes the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" - } - - @distributed_trace - def list_by_subscription( - self, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.VaultModel"]: - """Lists the vaults. - - Gets the list of vaults in the given subscription. - - :param continuation_token_parameter: Continuation token from the previous call. Default value - is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VaultModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VaultModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults" - } - - @distributed_trace - def list( - self, resource_group_name: str, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.VaultModel"]: - """Lists the vaults. - - Gets the list of vaults in the given subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param continuation_token_parameter: Continuation token from the previous call. Default value - is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VaultModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.VaultModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VaultModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_workflow_operation_status_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_workflow_operation_status_operations.py deleted file mode 100644 index 0a45461c96cf..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_workflow_operation_status_operations.py +++ /dev/null @@ -1,162 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_name: str, job_name: str, operation_id: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}/operations/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkflowOperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`workflow_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, job_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Gets the job (workflow) operation status. - - Tracks the results of an asynchronous operation on the job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param job_name: The job (workflow) name. Required. - :type job_name: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - job_name=job_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}/operations/{operationId}" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_workflow_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_workflow_operations.py deleted file mode 100644 index 5f52efa9e62d..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/azure/mgmt/recoveryservicesdatareplication/operations/_workflow_operations.py +++ /dev/null @@ -1,309 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import RecoveryServicesDataReplicationMgmtClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_name: str, job_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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - vault_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - continuation_token_parameter: 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", "2021-02-16-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str", pattern=r"^[a-zA-Z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) - _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 WorkflowOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicesdatareplication.RecoveryServicesDataReplicationMgmtClient`'s - :attr:`workflow` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, vault_name: str, job_name: str, **kwargs: Any) -> _models.WorkflowModel: - """Gets the job (workflow). - - Gets the details of the job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param job_name: The job (workflow) name. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkflowModel or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkflowModel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkflowModel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}" - } - - @distributed_trace - def list( - self, - resource_group_name: str, - vault_name: str, - filter: Optional[str] = None, - continuation_token_parameter: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.WorkflowModel"]: - """Lists the jobs (workflows). - - Gets the list of jobs in the given vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The vault name. Required. - :type vault_name: str - :param filter: Filter string. Default value is None. - :type filter: str - :param continuation_token_parameter: Continuation token. Default value is None. - :type continuation_token_parameter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkflowModel or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesdatareplication.models.WorkflowModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkflowModelCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - filter=filter, - continuation_token_parameter=continuation_token_parameter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkflowModelCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs" - } diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/check_name_availability.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/check_name_availability_post.py similarity index 76% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/check_name_availability.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/check_name_availability_post.py index 57cbf847afa4..a3b4b0b55167 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/check_name_availability.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/check_name_availability_post.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-recoveryservicesdatareplication # USAGE - python check_name_availability.py + python check_name_availability_post.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, @@ -26,15 +27,15 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - response = client.check_name_availability( + response = client.check_name_availability.post( location="trfqtbtmusswpibw", ) print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/CheckNameAvailability.json +# x-ms-original-file: 2024-09-01/CheckNameAvailability_Post.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/deployment_preflight.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/deployment_preflight.py deleted file mode 100644 index 158e1f0a3665..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/deployment_preflight.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python deployment_preflight.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 = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.deployment_preflight( - resource_group_name="rgrecoveryservicesdatareplication", - deployment_id="kjoiahxljomjcmvabaobumg", - ) - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/DeploymentPreflight.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/deployment_preflight_post.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/deployment_preflight_post.py new file mode 100644 index 000000000000..3ffb2a7d2de0 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/deployment_preflight_post.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python deployment_preflight_post.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 = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.deployment_preflight.post( + resource_group_name="rgswagger_2024-09-01", + deployment_id="lnfcwsmlowbwkndkztzvaj", + ) + print(response) + + +# x-ms-original-file: 2024-09-01/DeploymentPreflight_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_create.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_create.py deleted file mode 100644 index 9511f975b62c..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_create.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python dra_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.dra.begin_create( - resource_group_name="rgrecoveryservicesdatareplication", - fabric_name="wPR", - fabric_agent_name="M", - ).result() - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_operation_status_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_operation_status_get.py deleted file mode 100644 index e8aff76911d8..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_operation_status_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python dra_operation_status_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.dra_operation_status.get( - resource_group_name="rgrecoveryservicesdatareplication", - fabric_name="wPR", - fabric_agent_name="M", - operation_id="dadsqwcq", - ) - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/DraOperationStatus_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_create.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_create.py deleted file mode 100644 index 2feed4b7a2ef..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_create.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python email_configuration_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.email_configuration.create( - resource_group_name="rgrecoveryservicesdatareplication", - vault_name="4", - email_configuration_name="0", - ) - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_get.py index 3c3eb9838a44..53d389d5d60e 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,17 +27,17 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.email_configuration.get( - resource_group_name="rgrecoveryservicesdatareplication", + resource_group_name="rgswagger_2024-09-01", vault_name="4", email_configuration_name="0", ) print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Get.json +# x-ms-original-file: 2024-09-01/EmailConfiguration_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_list.py index 294a581f44d2..275d8b2d0632 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/email_configuration_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,17 +27,17 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.email_configuration.list( - resource_group_name="rgrecoveryservicesdatareplication", + resource_group_name="rgswagger_2024-09-01", vault_name="4", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_List.json +# x-ms-original-file: 2024-09-01/EmailConfiguration_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/event_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/event_get.py index acda6d5e70f3..80e053a51c56 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/event_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/event_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,17 +27,17 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.event.get( - resource_group_name="rgrecoveryservicesdatareplication", + resource_group_name="rgswagger_2024-09-01", vault_name="4", event_name="231CIG", ) print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_Get.json +# x-ms-original-file: 2024-09-01/Event_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/event_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/event_list.py index a81b076a6f85..01ad5394b2c3 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/event_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/event_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,17 +27,17 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.event.list( - resource_group_name="rgrecoveryservicesdatareplication", + resource_group_name="rgswagger_2024-09-01", vault_name="4", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_List.json +# x-ms-original-file: 2024-09-01/Event_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_delete.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_agent_delete.py similarity index 75% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_delete.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_agent_delete.py index dfe21fd58c44..fdb24bfa2c60 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_delete.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_agent_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-recoveryservicesdatareplication # USAGE - python dra_delete.py + python fabric_agent_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,16 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - client.dra.begin_delete( - resource_group_name="rgrecoveryservicesdatareplication", + client.fabric_agent.begin_delete( + resource_group_name="rgswagger_2024-09-01", fabric_name="wPR", fabric_agent_name="M", ).result() -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Delete.json +# x-ms-original-file: 2024-09-01/FabricAgent_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_agent_get.py similarity index 80% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_get.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_agent_get.py index b1b345a926a0..c047cfd5272c 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_agent_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-recoveryservicesdatareplication # USAGE - python dra_get.py + python fabric_agent_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,10 +27,10 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - response = client.dra.get( + response = client.fabric_agent.get( resource_group_name="rgrecoveryservicesdatareplication", fabric_name="wPR", fabric_agent_name="M", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Get.json +# x-ms-original-file: 2024-09-01/FabricAgent_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_agent_list.py similarity index 76% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_list.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_agent_list.py index b47a2f3cf7fd..604f70335e37 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/dra_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_agent_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-recoveryservicesdatareplication # USAGE - python dra_list.py + python fabric_agent_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, @@ -26,17 +27,17 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - response = client.dra.list( - resource_group_name="rgrecoveryservicesdatareplication", + response = client.fabric_agent.list( + resource_group_name="rgswagger_2024-09-01", fabric_name="wPR", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_List.json +# x-ms-original-file: 2024-09-01/FabricAgent_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_create.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_create.py deleted file mode 100644 index b5ca6274034b..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_create.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python fabric_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.fabric.begin_create( - resource_group_name="rgrecoveryservicesdatareplication", - fabric_name="wPR", - ).result() - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_delete.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_delete.py index a2f71f220375..b8868ace287c 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_delete.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) client.fabric.begin_delete( @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Delete.json +# x-ms-original-file: 2024-09-01/Fabric_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_get.py index 594ace3d4d75..56158319d0d5 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.fabric.get( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Get.json +# x-ms-original-file: 2024-09-01/Fabric_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_list.py index e4328b94ba6d..9e08af6b9dec 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,16 +27,16 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.fabric.list( - resource_group_name="rgrecoveryservicesdatareplication", + resource_group_name="rgswagger_2024-09-01", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_List.json +# x-ms-original-file: 2024-09-01/Fabric_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_list_by_subscription.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_list_by_subscription.py index 5f95116e3b9c..175862c480d6 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_list_by_subscription.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_list_by_subscription.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.fabric.list_by_subscription() @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_ListBySubscription.json +# x-ms-original-file: 2024-09-01/Fabric_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_operations_status_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_operations_status_get.py deleted file mode 100644 index ebb69cac3f34..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_operations_status_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python fabric_operations_status_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.fabric_operations_status.get( - resource_group_name="rgrecoveryservicesdatareplication", - fabric_name="wPR", - operation_id="dvfwerv", - ) - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/FabricOperationsStatus_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_update.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_update.py deleted file mode 100644 index 1972dbe36a93..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/fabric_update.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python fabric_update.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 = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.fabric.begin_update( - resource_group_name="rgrecoveryservicesdatareplication", - fabric_name="wPR", - ).result() - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/job_get.py similarity index 79% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_get.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/job_get.py index 52c54c214b84..abf1c0489bef 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/job_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-recoveryservicesdatareplication # USAGE - python workflow_get.py + python job_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,10 +27,10 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - response = client.workflow.get( + response = client.job.get( resource_group_name="rgrecoveryservicesdatareplication", vault_name="4", job_name="ZGH4y", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_Get.json +# x-ms-original-file: 2024-09-01/Job_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/job_list.py similarity index 79% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_list.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/job_list.py index 709b78e5ba0c..2038031b64df 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/job_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-recoveryservicesdatareplication # USAGE - python workflow_list.py + python job_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, @@ -26,10 +27,10 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - response = client.workflow.list( + response = client.job.list( resource_group_name="rgrecoveryservicesdatareplication", vault_name="4", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_List.json +# x-ms-original-file: 2024-09-01/Job_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/location_based_operation_results_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/location_based_operation_results_get.py new file mode 100644 index 000000000000..525090a04e56 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/location_based_operation_results_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python location_based_operation_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.location_based_operation_results.get( + resource_group_name="rgswagger_2024-09-01", + location="Central US EUAP", + operation_id="lghle", + ) + print(response) + + +# x-ms-original-file: 2024-09-01/LocationBasedOperationResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/operation_results_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/operation_results_get.py new file mode 100644 index 000000000000..7d7453ff119b --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/operation_results_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python operation_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operation_results.get( + resource_group_name="rgswagger_2024-09-01", + operation_id="lghle", + ) + print(response) + + +# x-ms-original-file: 2024-09-01/OperationResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/operations_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/operations_list.py index 61dd8e0e5bf6..fe37943a5d85 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/operations_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/operations_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Operations_List.json +# x-ms-original-file: 2024-09-01/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_create.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_create.py deleted file mode 100644 index 23c3dc138d4a..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_create.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python policy_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.policy.begin_create( - resource_group_name="rgrecoveryservicesdatareplication", - vault_name="4", - policy_name="fafqwc", - ).result() - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_delete.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_delete.py index a702d9bbb09c..0a975085d24a 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_delete.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) client.policy.begin_delete( @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Delete.json +# x-ms-original-file: 2024-09-01/Policy_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_get.py index acf0b670ad0b..f81e8b71568b 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.policy.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Get.json +# x-ms-original-file: 2024-09-01/Policy_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_list.py index 868a0a7a537a..60ef8f23b00e 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.policy.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_List.json +# x-ms-original-file: 2024-09-01/Policy_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_operation_status_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_operation_status_get.py deleted file mode 100644 index 438d64f5dac1..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/policy_operation_status_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python policy_operation_status_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.policy_operation_status.get( - resource_group_name="rgrecoveryservicesdatareplication", - vault_name="4", - policy_name="xczxcwec", - operation_id="wdqfsdxv", - ) - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/PolicyOperationStatus_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_delete.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_delete.py new file mode 100644 index 000000000000..a881cb27a9be --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python private_endpoint_connection_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.private_endpoint_connections.begin_delete( + resource_group_name="rgswagger_2024-09-01", + vault_name="4", + private_endpoint_connection_name="sdwqtfhigjirrzhpbmqtzgs", + ).result() + + +# x-ms-original-file: 2024-09-01/PrivateEndpointConnection_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_update.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_get.py similarity index 74% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_update.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_get.py index 750f3a26bee2..60ee5ea579e0 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_update.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-recoveryservicesdatareplication # USAGE - python vault_update.py + python private_endpoint_connection_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,17 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - response = client.vault.begin_update( - resource_group_name="rgrecoveryservicesdatareplication", + response = client.private_endpoint_connections.get( + resource_group_name="rgswagger_2024-09-01", vault_name="4", - ).result() + private_endpoint_connection_name="vbkm", + ) print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Update.json +# x-ms-original-file: 2024-09-01/PrivateEndpointConnection_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_list.py new file mode 100644 index 000000000000..c4f42a3af02a --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_list.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python private_endpoint_connection_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 = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections.list( + resource_group_name="rgswagger_2024-09-01", + vault_name="4", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-09-01/PrivateEndpointConnection_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_delete.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_delete.py new file mode 100644 index 000000000000..7054e2d01558 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python private_endpoint_connection_proxy_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.private_endpoint_connection_proxies.begin_delete( + resource_group_name="rgswagger_2024-09-01", + vault_name="4", + private_endpoint_connection_proxy_name="d", + ).result() + + +# x-ms-original-file: 2024-09-01/PrivateEndpointConnectionProxy_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_create.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_get.py similarity index 74% rename from sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_create.py rename to sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_get.py index 32ca942e0c1a..b16d08c73cb8 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_create.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-recoveryservicesdatareplication # USAGE - python vault_create.py + python private_endpoint_connection_proxy_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,17 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - response = client.vault.begin_create( - resource_group_name="rgrecoveryservicesdatareplication", + response = client.private_endpoint_connection_proxies.get( + resource_group_name="rgswagger_2024-09-01", vault_name="4", - ).result() + private_endpoint_connection_proxy_name="d", + ) print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Create.json +# x-ms-original-file: 2024-09-01/PrivateEndpointConnectionProxy_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_list.py new file mode 100644 index 000000000000..f5c1a23230be --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_list.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python private_endpoint_connection_proxy_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 = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connection_proxies.list( + resource_group_name="rgswagger_2024-09-01", + vault_name="4", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-09-01/PrivateEndpointConnectionProxy_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_validate.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_validate.py new file mode 100644 index 000000000000..9c7c35beecd3 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_endpoint_connection_proxy_validate.py @@ -0,0 +1,95 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python private_endpoint_connection_proxy_validate.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 = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connection_proxies.validate( + resource_group_name="rgswagger_2024-09-01", + vault_name="4", + private_endpoint_connection_proxy_name="d", + body={ + "etag": "hruibxrezstxroxrxweh", + "properties": { + "remotePrivateEndpoint": { + "connectionDetails": [ + { + "groupId": "pjrlygpadir", + "id": "lenqkogzkes", + "linkIdentifier": "ravfufhkdowufd", + "memberName": "ybuysjrlfupewxe", + "privateIpAddress": "cyiacdzzyqmxjpijjbwgasegehtqe", + } + ], + "id": "yipalno", + "manualPrivateLinkServiceConnections": [ + { + "groupIds": ["hvejynjktikteipnioyeja"], + "name": "jqwntlzfsksl", + "requestMessage": "bukgzpkvcvfbmcdmpcbiigbvugicqa", + } + ], + "privateLinkServiceConnections": [ + { + "groupIds": ["hvejynjktikteipnioyeja"], + "name": "jqwntlzfsksl", + "requestMessage": "bukgzpkvcvfbmcdmpcbiigbvugicqa", + } + ], + "privateLinkServiceProxies": [ + { + "groupConnectivityInformation": [ + { + "customerVisibleFqdns": ["vedcg"], + "groupId": "per", + "internalFqdn": "maqavwhxwzzhbzjbryyquvitmup", + "memberName": "ybptuypgdqoxkuwqx", + "privateLinkServiceArmRegion": "rerkqqxinteevmlbrdkktaqhcch", + "redirectMapId": "pezncxcq", + } + ], + "id": "nzqxevuyqeedrqnkbnlcyrrrbzxvl", + "remotePrivateEndpointConnection": {"id": "ocunsgawjsqohkrcyxiv"}, + "remotePrivateLinkServiceConnectionState": { + "actionsRequired": "afwbq", + "description": "y", + "status": "Approved", + }, + } + ], + } + }, + }, + ) + print(response) + + +# x-ms-original-file: 2024-09-01/PrivateEndpointConnectionProxy_Validate.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_link_resource_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_link_resource_get.py new file mode 100644 index 000000000000..a74bdef9d62c --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_link_resource_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python private_link_resource_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_link_resources.get( + resource_group_name="rgswagger_2024-09-01", + vault_name="4", + private_link_resource_name="d", + ) + print(response) + + +# x-ms-original-file: 2024-09-01/PrivateLinkResource_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_link_resource_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_link_resource_list.py new file mode 100644 index 000000000000..d2a8c7cfe3e8 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/private_link_resource_list.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesdatareplication +# USAGE + python private_link_resource_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 = RecoveryServicesDataReplicationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_link_resources.list( + resource_group_name="rgswagger_2024-09-01", + vault_name="4", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-09-01/PrivateLinkResource_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_create.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_create.py deleted file mode 100644 index d8f37186a52f..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_create.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python protected_item_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.protected_item.begin_create( - resource_group_name="rgrecoveryservicesdatareplication", - vault_name="4", - protected_item_name="d", - ).result() - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_delete.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_delete.py index a403f3213586..6f12099bc625 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_delete.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) client.protected_item.begin_delete( @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Delete.json +# x-ms-original-file: 2024-09-01/ProtectedItem_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_get.py index 7c8694a6e78c..8ac487eae4c4 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.protected_item.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Get.json +# x-ms-original-file: 2024-09-01/ProtectedItem_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_list.py index e1f0810b5127..522a71f58193 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.protected_item.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_List.json +# x-ms-original-file: 2024-09-01/ProtectedItem_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_operation_status_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_operation_status_get.py deleted file mode 100644 index 2a700a39aef0..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_operation_status_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python protected_item_operation_status_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.protected_item_operation_status.get( - resource_group_name="rgrecoveryservicesdatareplication", - vault_name="4", - protected_item_name="d", - operation_id="wdqacsc", - ) - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItemOperationStatus_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_planned_failover.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_planned_failover.py index fc860a30739c..4f578eeefceb 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_planned_failover.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/protected_item_planned_failover.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,17 +27,18 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.protected_item.begin_planned_failover( resource_group_name="rgrecoveryservicesdatareplication", vault_name="4", protected_item_name="d", + body={"properties": {"customProperties": {"instanceType": "PlannedFailoverModelCustomProperties"}}}, ).result() print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_PlannedFailover.json +# x-ms-original-file: 2024-09-01/ProtectedItem_PlannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/recovery_points_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/recovery_points_get.py index 5b42e46b6c30..83e588818569 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/recovery_points_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/recovery_points_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,10 +27,10 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - response = client.recovery_points.get( + response = client.recovery_point.get( resource_group_name="rgrecoveryservicesdatareplication", vault_name="4", protected_item_name="d", @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_Get.json +# x-ms-original-file: 2024-09-01/RecoveryPoints_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/recovery_points_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/recovery_points_list.py index e22874bc3921..563deddc3a15 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/recovery_points_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/recovery_points_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,10 +27,10 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) - response = client.recovery_points.list( + response = client.recovery_point.list( resource_group_name="rgrecoveryservicesdatareplication", vault_name="4", protected_item_name="d", @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_List.json +# x-ms-original-file: 2024-09-01/RecoveryPoints_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_create.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_create.py deleted file mode 100644 index a9216adb2664..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_create.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python replication_extension_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.replication_extension.begin_create( - resource_group_name="rgrecoveryservicesdatareplication", - vault_name="4", - replication_extension_name="g16yjJ", - ).result() - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_delete.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_delete.py index f647c3143342..dcb172e9719c 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_delete.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) client.replication_extension.begin_delete( @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Delete.json +# x-ms-original-file: 2024-09-01/ReplicationExtension_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_get.py index 2957df01dfc1..311f3079fdbf 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_extension.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Get.json +# x-ms-original-file: 2024-09-01/ReplicationExtension_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_list.py index 8023e8e16411..c585482ea644 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_extension.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_List.json +# x-ms-original-file: 2024-09-01/ReplicationExtension_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_operation_status_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_operation_status_get.py deleted file mode 100644 index d1af0bd506ba..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/replication_extension_operation_status_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python replication_extension_operation_status_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.replication_extension_operation_status.get( - resource_group_name="rgrecoveryservicesdatareplication", - vault_name="4", - replication_extension_name="g16yjJ", - operation_id="wqdqc", - ) - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtensionOperationStatus_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_delete.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_delete.py index 3bacb61d0cd2..90ce12c1fba3 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_delete.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) client.vault.begin_delete( @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Delete.json +# x-ms-original-file: 2024-09-01/Vault_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_get.py index 14e55ae22d67..8e99b6e77ec7 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_get.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.vault.get( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Get.json +# x-ms-original-file: 2024-09-01/Vault_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_list.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_list.py index 31754dee6d49..ab9e1ce28645 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_list.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.vault.list( @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_List.json +# x-ms-original-file: 2024-09-01/Vault_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_list_by_subscription.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_list_by_subscription.py index 6e2908ed31a8..aa8ef40fc1b1 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_list_by_subscription.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_list_by_subscription.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = RecoveryServicesDataReplicationMgmtClient( credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", + subscription_id="SUBSCRIPTION_ID", ) response = client.vault.list_by_subscription() @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_ListBySubscription.json +# x-ms-original-file: 2024-09-01/Vault_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_operation_status_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_operation_status_get.py deleted file mode 100644 index 52a6ff825941..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/vault_operation_status_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python vault_operation_status_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.vault_operation_status.get( - resource_group_name="rgrecoveryservicesdatareplication", - vault_name="4", - operation_id="vsdvwe", - ) - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/VaultOperationStatus_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_operation_status_get.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_operation_status_get.py deleted file mode 100644 index ea534fb2486a..000000000000 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_samples/workflow_operation_status_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-recoveryservicesdatareplication -# USAGE - python workflow_operation_status_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RecoveryServicesDataReplicationMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF", - ) - - response = client.workflow_operation_status.get( - resource_group_name="rgrecoveryservicesdatareplication", - vault_name="4", - job_name="ZGH4y", - operation_id="wdqcxc", - ) - print(response) - - -# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/WorkflowOperationStatus_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/conftest.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/conftest.py new file mode 100644 index 000000000000..559c9a69591f --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/conftest.py @@ -0,0 +1,51 @@ +# 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): + recoveryservicesdatareplicationmgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + recoveryservicesdatareplicationmgmt_tenant_id = os.environ.get( + "AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000" + ) + recoveryservicesdatareplicationmgmt_client_id = os.environ.get( + "AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000" + ) + recoveryservicesdatareplicationmgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=recoveryservicesdatareplicationmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=recoveryservicesdatareplicationmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=recoveryservicesdatareplicationmgmt_client_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=recoveryservicesdatareplicationmgmt_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/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_check_name_availability_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_check_name_availability_operations.py new file mode 100644 index 000000000000..2ca99d8654a8 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_check_name_availability_operations.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 pytest +from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtCheckNameAvailabilityOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability_post(self, resource_group): + response = self.client.check_name_availability.post( + location="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_check_name_availability_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_check_name_availability_operations_async.py new file mode 100644 index 000000000000..4a8fcda674cc --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_check_name_availability_operations_async.py @@ -0,0 +1,30 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtCheckNameAvailabilityOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability_post(self, resource_group): + response = await self.client.check_name_availability.post( + location="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_deployment_preflight_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_deployment_preflight_operations.py new file mode 100644 index 000000000000..77d3e12681ec --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_deployment_preflight_operations.py @@ -0,0 +1,30 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtDeploymentPreflightOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deployment_preflight_post(self, resource_group): + response = self.client.deployment_preflight.post( + resource_group_name=resource_group.name, + deployment_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_deployment_preflight_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_deployment_preflight_operations_async.py new file mode 100644 index 000000000000..ed6fe4901d09 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_deployment_preflight_operations_async.py @@ -0,0 +1,31 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtDeploymentPreflightOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deployment_preflight_post(self, resource_group): + response = await self.client.deployment_preflight.post( + resource_group_name=resource_group.name, + deployment_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_email_configuration_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_email_configuration_operations.py new file mode 100644 index 000000000000..6118bd9ec1c6 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_email_configuration_operations.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtEmailConfigurationOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_email_configuration_get(self, resource_group): + response = self.client.email_configuration.get( + resource_group_name=resource_group.name, + vault_name="str", + email_configuration_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_email_configuration_create(self, resource_group): + response = self.client.email_configuration.create( + resource_group_name=resource_group.name, + vault_name="str", + email_configuration_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "sendToOwners": bool, + "customEmailAddresses": ["str"], + "locale": "str", + "provisioningState": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_email_configuration_list(self, resource_group): + response = self.client.email_configuration.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_email_configuration_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_email_configuration_operations_async.py new file mode 100644 index 000000000000..09b579ba2c8e --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_email_configuration_operations_async.py @@ -0,0 +1,74 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtEmailConfigurationOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_email_configuration_get(self, resource_group): + response = await self.client.email_configuration.get( + resource_group_name=resource_group.name, + vault_name="str", + email_configuration_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_email_configuration_create(self, resource_group): + response = await self.client.email_configuration.create( + resource_group_name=resource_group.name, + vault_name="str", + email_configuration_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "sendToOwners": bool, + "customEmailAddresses": ["str"], + "locale": "str", + "provisioningState": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_email_configuration_list(self, resource_group): + response = self.client.email_configuration.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_event_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_event_operations.py new file mode 100644 index 000000000000..e41e246cefdf --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_event_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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtEventOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_get(self, resource_group): + response = self.client.event.get( + resource_group_name=resource_group.name, + vault_name="str", + event_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_list(self, resource_group): + response = self.client.event.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_event_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_event_operations_async.py new file mode 100644 index 000000000000..4a167ba115c0 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_event_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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtEventOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_get(self, resource_group): + response = await self.client.event.get( + resource_group_name=resource_group.name, + vault_name="str", + event_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_list(self, resource_group): + response = self.client.event.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_agent_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_agent_operations.py new file mode 100644 index 000000000000..0c6782477fa5 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_agent_operations.py @@ -0,0 +1,135 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtFabricAgentOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fabric_agent_get(self, resource_group): + response = self.client.fabric_agent.get( + resource_group_name=resource_group.name, + fabric_name="str", + fabric_agent_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fabric_agent_begin_create(self, resource_group): + response = self.client.fabric_agent.begin_create( + resource_group_name=resource_group.name, + fabric_name="str", + fabric_agent_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "authenticationIdentity": { + "aadAuthority": "str", + "applicationId": "str", + "audience": "str", + "objectId": "str", + "tenantId": "str", + }, + "customProperties": "fabric_agent_model_custom_properties", + "machineId": "str", + "machineName": "str", + "resourceAccessIdentity": { + "aadAuthority": "str", + "applicationId": "str", + "audience": "str", + "objectId": "str", + "tenantId": "str", + }, + "correlationId": "str", + "healthErrors": [ + { + "affectedResourceCorrelationIds": ["str"], + "affectedResourceType": "str", + "category": "str", + "causes": "str", + "childErrors": [ + { + "category": "str", + "causes": "str", + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "isResponsive": bool, + "lastHeartbeat": "2020-02-20 00:00:00", + "provisioningState": "str", + "versionNumber": "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_fabric_agent_begin_delete(self, resource_group): + response = self.client.fabric_agent.begin_delete( + resource_group_name=resource_group.name, + fabric_name="str", + fabric_agent_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_fabric_agent_list(self, resource_group): + response = self.client.fabric_agent.list( + resource_group_name=resource_group.name, + fabric_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_agent_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_agent_operations_async.py new file mode 100644 index 000000000000..e9a18b96ac21 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_agent_operations_async.py @@ -0,0 +1,140 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtFabricAgentOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fabric_agent_get(self, resource_group): + response = await self.client.fabric_agent.get( + resource_group_name=resource_group.name, + fabric_name="str", + fabric_agent_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fabric_agent_begin_create(self, resource_group): + response = await ( + await self.client.fabric_agent.begin_create( + resource_group_name=resource_group.name, + fabric_name="str", + fabric_agent_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "authenticationIdentity": { + "aadAuthority": "str", + "applicationId": "str", + "audience": "str", + "objectId": "str", + "tenantId": "str", + }, + "customProperties": "fabric_agent_model_custom_properties", + "machineId": "str", + "machineName": "str", + "resourceAccessIdentity": { + "aadAuthority": "str", + "applicationId": "str", + "audience": "str", + "objectId": "str", + "tenantId": "str", + }, + "correlationId": "str", + "healthErrors": [ + { + "affectedResourceCorrelationIds": ["str"], + "affectedResourceType": "str", + "category": "str", + "causes": "str", + "childErrors": [ + { + "category": "str", + "causes": "str", + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "isResponsive": bool, + "lastHeartbeat": "2020-02-20 00:00:00", + "provisioningState": "str", + "versionNumber": "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_fabric_agent_begin_delete(self, resource_group): + response = await ( + await self.client.fabric_agent.begin_delete( + resource_group_name=resource_group.name, + fabric_name="str", + fabric_agent_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_fabric_agent_list(self, resource_group): + response = self.client.fabric_agent.list( + resource_group_name=resource_group.name, + fabric_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_operations.py new file mode 100644 index 000000000000..32e8554c8d4a --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_operations.py @@ -0,0 +1,188 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtFabricOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fabric_get(self, resource_group): + response = self.client.fabric.get( + resource_group_name=resource_group.name, + fabric_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fabric_begin_create(self, resource_group): + response = self.client.fabric.begin_create( + resource_group_name=resource_group.name, + fabric_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "customProperties": "fabric_model_custom_properties", + "health": "str", + "healthErrors": [ + { + "affectedResourceCorrelationIds": ["str"], + "affectedResourceType": "str", + "category": "str", + "causes": "str", + "childErrors": [ + { + "category": "str", + "causes": "str", + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "provisioningState": "str", + "serviceEndpoint": "str", + "serviceResourceId": "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_fabric_begin_update(self, resource_group): + response = self.client.fabric.begin_update( + resource_group_name=resource_group.name, + fabric_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { + "customProperties": "fabric_model_custom_properties", + "health": "str", + "healthErrors": [ + { + "affectedResourceCorrelationIds": ["str"], + "affectedResourceType": "str", + "category": "str", + "causes": "str", + "childErrors": [ + { + "category": "str", + "causes": "str", + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "provisioningState": "str", + "serviceEndpoint": "str", + "serviceResourceId": "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_fabric_begin_delete(self, resource_group): + response = self.client.fabric.begin_delete( + resource_group_name=resource_group.name, + fabric_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_fabric_list(self, resource_group): + response = self.client.fabric.list( + 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_fabric_list_by_subscription(self, resource_group): + response = self.client.fabric.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_operations_async.py new file mode 100644 index 000000000000..667309e5a646 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_fabric_operations_async.py @@ -0,0 +1,195 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtFabricOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fabric_get(self, resource_group): + response = await self.client.fabric.get( + resource_group_name=resource_group.name, + fabric_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fabric_begin_create(self, resource_group): + response = await ( + await self.client.fabric.begin_create( + resource_group_name=resource_group.name, + fabric_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "customProperties": "fabric_model_custom_properties", + "health": "str", + "healthErrors": [ + { + "affectedResourceCorrelationIds": ["str"], + "affectedResourceType": "str", + "category": "str", + "causes": "str", + "childErrors": [ + { + "category": "str", + "causes": "str", + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "provisioningState": "str", + "serviceEndpoint": "str", + "serviceResourceId": "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_fabric_begin_update(self, resource_group): + response = await ( + await self.client.fabric.begin_update( + resource_group_name=resource_group.name, + fabric_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { + "customProperties": "fabric_model_custom_properties", + "health": "str", + "healthErrors": [ + { + "affectedResourceCorrelationIds": ["str"], + "affectedResourceType": "str", + "category": "str", + "causes": "str", + "childErrors": [ + { + "category": "str", + "causes": "str", + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "provisioningState": "str", + "serviceEndpoint": "str", + "serviceResourceId": "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_fabric_begin_delete(self, resource_group): + response = await ( + await self.client.fabric.begin_delete( + resource_group_name=resource_group.name, + fabric_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_fabric_list(self, resource_group): + response = self.client.fabric.list( + 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_fabric_list_by_subscription(self, resource_group): + response = self.client.fabric.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_job_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_job_operations.py new file mode 100644 index 000000000000..596acaf1ba47 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_job_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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtJobOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_job_get(self, resource_group): + response = self.client.job.get( + resource_group_name=resource_group.name, + vault_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_job_list(self, resource_group): + response = self.client.job.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_job_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_job_operations_async.py new file mode 100644 index 000000000000..d2e73111f67a --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_job_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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtJobOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_job_get(self, resource_group): + response = await self.client.job.get( + resource_group_name=resource_group.name, + vault_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_job_list(self, resource_group): + response = self.client.job.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_location_based_operation_results_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_location_based_operation_results_operations.py new file mode 100644 index 000000000000..5cb888d227e5 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_location_based_operation_results_operations.py @@ -0,0 +1,31 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtLocationBasedOperationResultsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_location_based_operation_results_get(self, resource_group): + response = self.client.location_based_operation_results.get( + resource_group_name=resource_group.name, + location="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_location_based_operation_results_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_location_based_operation_results_operations_async.py new file mode 100644 index 000000000000..be3fa0168045 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_location_based_operation_results_operations_async.py @@ -0,0 +1,32 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtLocationBasedOperationResultsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_location_based_operation_results_get(self, resource_group): + response = await self.client.location_based_operation_results.get( + resource_group_name=resource_group.name, + location="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operation_results_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operation_results_operations.py new file mode 100644 index 000000000000..7b6ec0563231 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operation_results_operations.py @@ -0,0 +1,30 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtOperationResultsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_results_get(self, resource_group): + response = self.client.operation_results.get( + resource_group_name=resource_group.name, + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operation_results_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operation_results_operations_async.py new file mode 100644 index 000000000000..2bed773a19f4 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operation_results_operations_async.py @@ -0,0 +1,31 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtOperationResultsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_results_get(self, resource_group): + response = await self.client.operation_results.get( + resource_group_name=resource_group.name, + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operations.py new file mode 100644 index 000000000000..78a641e983d4 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @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/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_operations_async.py new file mode 100644 index 000000000000..b88ef50baaa3 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, 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/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_policy_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_policy_operations.py new file mode 100644 index 000000000000..11b10d1ba007 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_policy_operations.py @@ -0,0 +1,80 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtPolicyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_policy_get(self, resource_group): + response = self.client.policy.get( + resource_group_name=resource_group.name, + vault_name="str", + policy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_policy_begin_create(self, resource_group): + response = self.client.policy.begin_create( + resource_group_name=resource_group.name, + vault_name="str", + policy_name="str", + resource={ + "id": "str", + "name": "str", + "properties": {"customProperties": "policy_model_custom_properties", "provisioningState": "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_policy_begin_delete(self, resource_group): + response = self.client.policy.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + policy_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_policy_list(self, resource_group): + response = self.client.policy.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_policy_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_policy_operations_async.py new file mode 100644 index 000000000000..eada7064bd57 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_policy_operations_async.py @@ -0,0 +1,85 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtPolicyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_policy_get(self, resource_group): + response = await self.client.policy.get( + resource_group_name=resource_group.name, + vault_name="str", + policy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_policy_begin_create(self, resource_group): + response = await ( + await self.client.policy.begin_create( + resource_group_name=resource_group.name, + vault_name="str", + policy_name="str", + resource={ + "id": "str", + "name": "str", + "properties": {"customProperties": "policy_model_custom_properties", "provisioningState": "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_policy_begin_delete(self, resource_group): + response = await ( + await self.client.policy.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + policy_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_policy_list(self, resource_group): + response = self.client.policy.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connection_proxies_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connection_proxies_operations.py new file mode 100644 index 000000000000..6eb0d7b24492 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connection_proxies_operations.py @@ -0,0 +1,190 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtPrivateEndpointConnectionProxiesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connection_proxies_get(self, resource_group): + response = self.client.private_endpoint_connection_proxies.get( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_proxy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connection_proxies_create(self, resource_group): + response = self.client.private_endpoint_connection_proxies.create( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_proxy_name="str", + resource={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "provisioningState": "str", + "remotePrivateEndpoint": { + "id": "str", + "connectionDetails": [ + { + "groupId": "str", + "id": "str", + "linkIdentifier": "str", + "memberName": "str", + "privateIpAddress": "str", + } + ], + "manualPrivateLinkServiceConnections": [ + {"groupIds": ["str"], "name": "str", "requestMessage": "str"} + ], + "privateLinkServiceConnections": [ + {"groupIds": ["str"], "name": "str", "requestMessage": "str"} + ], + "privateLinkServiceProxies": [ + { + "groupConnectivityInformation": [ + { + "customerVisibleFqdns": ["str"], + "groupId": "str", + "internalFqdn": "str", + "memberName": "str", + "privateLinkServiceArmRegion": "str", + "redirectMapId": "str", + } + ], + "id": "str", + "remotePrivateEndpointConnection": {"id": "str"}, + "remotePrivateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connection_proxies_begin_delete(self, resource_group): + response = self.client.private_endpoint_connection_proxies.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_proxy_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_private_endpoint_connection_proxies_list(self, resource_group): + response = self.client.private_endpoint_connection_proxies.list( + resource_group_name=resource_group.name, + vault_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_private_endpoint_connection_proxies_validate(self, resource_group): + response = self.client.private_endpoint_connection_proxies.validate( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_proxy_name="str", + body={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "provisioningState": "str", + "remotePrivateEndpoint": { + "id": "str", + "connectionDetails": [ + { + "groupId": "str", + "id": "str", + "linkIdentifier": "str", + "memberName": "str", + "privateIpAddress": "str", + } + ], + "manualPrivateLinkServiceConnections": [ + {"groupIds": ["str"], "name": "str", "requestMessage": "str"} + ], + "privateLinkServiceConnections": [ + {"groupIds": ["str"], "name": "str", "requestMessage": "str"} + ], + "privateLinkServiceProxies": [ + { + "groupConnectivityInformation": [ + { + "customerVisibleFqdns": ["str"], + "groupId": "str", + "internalFqdn": "str", + "memberName": "str", + "privateLinkServiceArmRegion": "str", + "redirectMapId": "str", + } + ], + "id": "str", + "remotePrivateEndpointConnection": {"id": "str"}, + "remotePrivateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "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", + }, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connection_proxies_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connection_proxies_operations_async.py new file mode 100644 index 000000000000..923192e768fc --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connection_proxies_operations_async.py @@ -0,0 +1,193 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtPrivateEndpointConnectionProxiesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connection_proxies_get(self, resource_group): + response = await self.client.private_endpoint_connection_proxies.get( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_proxy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connection_proxies_create(self, resource_group): + response = await self.client.private_endpoint_connection_proxies.create( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_proxy_name="str", + resource={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "provisioningState": "str", + "remotePrivateEndpoint": { + "id": "str", + "connectionDetails": [ + { + "groupId": "str", + "id": "str", + "linkIdentifier": "str", + "memberName": "str", + "privateIpAddress": "str", + } + ], + "manualPrivateLinkServiceConnections": [ + {"groupIds": ["str"], "name": "str", "requestMessage": "str"} + ], + "privateLinkServiceConnections": [ + {"groupIds": ["str"], "name": "str", "requestMessage": "str"} + ], + "privateLinkServiceProxies": [ + { + "groupConnectivityInformation": [ + { + "customerVisibleFqdns": ["str"], + "groupId": "str", + "internalFqdn": "str", + "memberName": "str", + "privateLinkServiceArmRegion": "str", + "redirectMapId": "str", + } + ], + "id": "str", + "remotePrivateEndpointConnection": {"id": "str"}, + "remotePrivateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connection_proxies_begin_delete(self, resource_group): + response = await ( + await self.client.private_endpoint_connection_proxies.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_proxy_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_private_endpoint_connection_proxies_list(self, resource_group): + response = self.client.private_endpoint_connection_proxies.list( + resource_group_name=resource_group.name, + vault_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_private_endpoint_connection_proxies_validate(self, resource_group): + response = await self.client.private_endpoint_connection_proxies.validate( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_proxy_name="str", + body={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "provisioningState": "str", + "remotePrivateEndpoint": { + "id": "str", + "connectionDetails": [ + { + "groupId": "str", + "id": "str", + "linkIdentifier": "str", + "memberName": "str", + "privateIpAddress": "str", + } + ], + "manualPrivateLinkServiceConnections": [ + {"groupIds": ["str"], "name": "str", "requestMessage": "str"} + ], + "privateLinkServiceConnections": [ + {"groupIds": ["str"], "name": "str", "requestMessage": "str"} + ], + "privateLinkServiceProxies": [ + { + "groupConnectivityInformation": [ + { + "customerVisibleFqdns": ["str"], + "groupId": "str", + "internalFqdn": "str", + "memberName": "str", + "privateLinkServiceArmRegion": "str", + "redirectMapId": "str", + } + ], + "id": "str", + "remotePrivateEndpointConnection": {"id": "str"}, + "remotePrivateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "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", + }, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connections_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..26b0575eb8bb --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connections_operations.py @@ -0,0 +1,88 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_get(self, resource_group): + response = self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_update(self, resource_group): + response = self.client.private_endpoint_connections.update( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_begin_delete(self, resource_group): + response = self.client.private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_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_private_endpoint_connections_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connections_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..21b3aef1df4a --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_endpoint_connections_operations_async.py @@ -0,0 +1,91 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_get(self, resource_group): + response = await self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_update(self, resource_group): + response = await self.client.private_endpoint_connections.update( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_begin_delete(self, resource_group): + response = await ( + await self.client.private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + private_endpoint_connection_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_private_endpoint_connections_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_link_resources_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_link_resources_operations.py new file mode 100644 index 000000000000..3a62631f5c9c --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_link_resources_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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_resources_get(self, resource_group): + response = self.client.private_link_resources.get( + resource_group_name=resource_group.name, + vault_name="str", + private_link_resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_resources_list(self, resource_group): + response = self.client.private_link_resources.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_link_resources_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_link_resources_operations_async.py new file mode 100644 index 000000000000..f7851a2ac03e --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_private_link_resources_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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_link_resources_get(self, resource_group): + response = await self.client.private_link_resources.get( + resource_group_name=resource_group.name, + vault_name="str", + private_link_resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_link_resources_list(self, resource_group): + response = self.client.private_link_resources.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_protected_item_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_protected_item_operations.py new file mode 100644 index 000000000000..06a6df5bb068 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_protected_item_operations.py @@ -0,0 +1,212 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtProtectedItemOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_protected_item_get(self, resource_group): + response = self.client.protected_item.get( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_protected_item_begin_create(self, resource_group): + response = self.client.protected_item.begin_create( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "customProperties": "protected_item_model_custom_properties", + "policyName": "str", + "replicationExtensionName": "str", + "allowedJobs": ["str"], + "correlationId": "str", + "currentJob": { + "displayName": "str", + "endTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "scenarioName": "str", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "fabricAgentId": "str", + "fabricId": "str", + "fabricObjectId": "str", + "fabricObjectName": "str", + "healthErrors": [ + { + "affectedResourceCorrelationIds": ["str"], + "affectedResourceType": "str", + "category": "str", + "causes": "str", + "childErrors": [ + { + "category": "str", + "causes": "str", + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "lastFailedEnableProtectionJob": { + "displayName": "str", + "endTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "scenarioName": "str", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "lastFailedPlannedFailoverJob": { + "displayName": "str", + "endTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "scenarioName": "str", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "lastSuccessfulPlannedFailoverTime": "2020-02-20 00:00:00", + "lastSuccessfulTestFailoverTime": "2020-02-20 00:00:00", + "lastSuccessfulUnplannedFailoverTime": "2020-02-20 00:00:00", + "lastTestFailoverJob": { + "displayName": "str", + "endTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "scenarioName": "str", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "protectionState": "str", + "protectionStateDescription": "str", + "provisioningState": "str", + "replicationHealth": "str", + "resyncRequired": bool, + "resynchronizationState": "str", + "sourceFabricProviderId": "str", + "targetFabricAgentId": "str", + "targetFabricId": "str", + "targetFabricProviderId": "str", + "testFailoverState": "str", + "testFailoverStateDescription": "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_protected_item_begin_update(self, resource_group): + response = self.client.protected_item.begin_update( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + properties={ + "id": "str", + "name": "str", + "properties": {"customProperties": "protected_item_model_custom_properties_update"}, + "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_protected_item_begin_delete(self, resource_group): + response = self.client.protected_item.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_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_protected_item_list(self, resource_group): + response = self.client.protected_item.list( + resource_group_name=resource_group.name, + vault_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_protected_item_begin_planned_failover(self, resource_group): + response = self.client.protected_item.begin_planned_failover( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + body={"properties": {"customProperties": "planned_failover_model_custom_properties"}}, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_protected_item_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_protected_item_operations_async.py new file mode 100644 index 000000000000..90f1899be0b6 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_protected_item_operations_async.py @@ -0,0 +1,221 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtProtectedItemOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_protected_item_get(self, resource_group): + response = await self.client.protected_item.get( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_protected_item_begin_create(self, resource_group): + response = await ( + await self.client.protected_item.begin_create( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "customProperties": "protected_item_model_custom_properties", + "policyName": "str", + "replicationExtensionName": "str", + "allowedJobs": ["str"], + "correlationId": "str", + "currentJob": { + "displayName": "str", + "endTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "scenarioName": "str", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "fabricAgentId": "str", + "fabricId": "str", + "fabricObjectId": "str", + "fabricObjectName": "str", + "healthErrors": [ + { + "affectedResourceCorrelationIds": ["str"], + "affectedResourceType": "str", + "category": "str", + "causes": "str", + "childErrors": [ + { + "category": "str", + "causes": "str", + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "code": "str", + "creationTime": "2020-02-20 00:00:00", + "healthCategory": "str", + "isCustomerResolvable": bool, + "message": "str", + "recommendation": "str", + "severity": "str", + "source": "str", + "summary": "str", + } + ], + "lastFailedEnableProtectionJob": { + "displayName": "str", + "endTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "scenarioName": "str", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "lastFailedPlannedFailoverJob": { + "displayName": "str", + "endTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "scenarioName": "str", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "lastSuccessfulPlannedFailoverTime": "2020-02-20 00:00:00", + "lastSuccessfulTestFailoverTime": "2020-02-20 00:00:00", + "lastSuccessfulUnplannedFailoverTime": "2020-02-20 00:00:00", + "lastTestFailoverJob": { + "displayName": "str", + "endTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "scenarioName": "str", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "protectionState": "str", + "protectionStateDescription": "str", + "provisioningState": "str", + "replicationHealth": "str", + "resyncRequired": bool, + "resynchronizationState": "str", + "sourceFabricProviderId": "str", + "targetFabricAgentId": "str", + "targetFabricId": "str", + "targetFabricProviderId": "str", + "testFailoverState": "str", + "testFailoverStateDescription": "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_protected_item_begin_update(self, resource_group): + response = await ( + await self.client.protected_item.begin_update( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + properties={ + "id": "str", + "name": "str", + "properties": {"customProperties": "protected_item_model_custom_properties_update"}, + "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_protected_item_begin_delete(self, resource_group): + response = await ( + await self.client.protected_item.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_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_protected_item_list(self, resource_group): + response = self.client.protected_item.list( + resource_group_name=resource_group.name, + vault_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_protected_item_begin_planned_failover(self, resource_group): + response = await ( + await self.client.protected_item.begin_planned_failover( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + body={"properties": {"customProperties": "planned_failover_model_custom_properties"}}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_recovery_point_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_recovery_point_operations.py new file mode 100644 index 000000000000..de2b00f07507 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_recovery_point_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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtRecoveryPointOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_recovery_point_get(self, resource_group): + response = self.client.recovery_point.get( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + recovery_point_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_recovery_point_list(self, resource_group): + response = self.client.recovery_point.list( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_recovery_point_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_recovery_point_operations_async.py new file mode 100644 index 000000000000..148b4caaaa05 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_recovery_point_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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtRecoveryPointOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_recovery_point_get(self, resource_group): + response = await self.client.recovery_point.get( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + recovery_point_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_recovery_point_list(self, resource_group): + response = self.client.recovery_point.list( + resource_group_name=resource_group.name, + vault_name="str", + protected_item_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_replication_extension_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_replication_extension_operations.py new file mode 100644 index 000000000000..2a0cd597a5c6 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_replication_extension_operations.py @@ -0,0 +1,83 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtReplicationExtensionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_replication_extension_get(self, resource_group): + response = self.client.replication_extension.get( + resource_group_name=resource_group.name, + vault_name="str", + replication_extension_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_replication_extension_begin_create(self, resource_group): + response = self.client.replication_extension.begin_create( + resource_group_name=resource_group.name, + vault_name="str", + replication_extension_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "customProperties": "replication_extension_model_custom_properties", + "provisioningState": "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_replication_extension_begin_delete(self, resource_group): + response = self.client.replication_extension.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + replication_extension_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_replication_extension_list(self, resource_group): + response = self.client.replication_extension.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_replication_extension_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_replication_extension_operations_async.py new file mode 100644 index 000000000000..b70bc2e70263 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_replication_extension_operations_async.py @@ -0,0 +1,88 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtReplicationExtensionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_replication_extension_get(self, resource_group): + response = await self.client.replication_extension.get( + resource_group_name=resource_group.name, + vault_name="str", + replication_extension_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_replication_extension_begin_create(self, resource_group): + response = await ( + await self.client.replication_extension.begin_create( + resource_group_name=resource_group.name, + vault_name="str", + replication_extension_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "customProperties": "replication_extension_model_custom_properties", + "provisioningState": "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_replication_extension_begin_delete(self, resource_group): + response = await ( + await self.client.replication_extension.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + replication_extension_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_replication_extension_list(self, resource_group): + response = self.client.replication_extension.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_vault_operations.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_vault_operations.py new file mode 100644 index 000000000000..cec51b8ff511 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_vault_operations.py @@ -0,0 +1,119 @@ +# 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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtVaultOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vault_get(self, resource_group): + response = self.client.vault.get( + resource_group_name=resource_group.name, + vault_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vault_begin_create(self, resource_group): + response = self.client.vault.begin_create( + resource_group_name=resource_group.name, + vault_name="str", + resource={ + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "properties": {"provisioningState": "str", "serviceResourceId": "str", "vaultType": "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_vault_begin_update(self, resource_group): + response = self.client.vault.begin_update( + resource_group_name=resource_group.name, + vault_name="str", + properties={ + "id": "str", + "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, + "name": "str", + "properties": {"provisioningState": "str", "serviceResourceId": "str", "vaultType": "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_vault_begin_delete(self, resource_group): + response = self.client.vault.begin_delete( + resource_group_name=resource_group.name, + 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_vault_list(self, resource_group): + response = self.client.vault.list( + 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_vault_list_by_subscription(self, resource_group): + response = self.client.vault.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_vault_operations_async.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_vault_operations_async.py new file mode 100644 index 000000000000..015bc15e99c7 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/generated_tests/test_recovery_services_data_replication_mgmt_vault_operations_async.py @@ -0,0 +1,126 @@ +# 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.recoveryservicesdatareplication.aio import RecoveryServicesDataReplicationMgmtClient + +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 TestRecoveryServicesDataReplicationMgmtVaultOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(RecoveryServicesDataReplicationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_vault_get(self, resource_group): + response = await self.client.vault.get( + resource_group_name=resource_group.name, + vault_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_vault_begin_create(self, resource_group): + response = await ( + await self.client.vault.begin_create( + resource_group_name=resource_group.name, + vault_name="str", + resource={ + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "properties": {"provisioningState": "str", "serviceResourceId": "str", "vaultType": "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_vault_begin_update(self, resource_group): + response = await ( + await self.client.vault.begin_update( + resource_group_name=resource_group.name, + vault_name="str", + properties={ + "id": "str", + "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, + "name": "str", + "properties": {"provisioningState": "str", "serviceResourceId": "str", "vaultType": "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_vault_begin_delete(self, resource_group): + response = await ( + await self.client.vault.begin_delete( + resource_group_name=resource_group.name, + 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_vault_list(self, resource_group): + response = self.client.vault.list( + 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_vault_list_by_subscription(self, resource_group): + response = self.client.vault.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/sdk_packaging.toml b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/sdk_packaging.toml index d294588de916..e161e8184bf3 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/sdk_packaging.toml +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-recoveryservicesdatareplication" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Recoveryservicesdatareplication Management" package_doc_id = "" -is_stable = false +is_stable = true is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/setup.py b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/setup.py index 11a93b4b23d8..2747ff8c9424 100644 --- a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/setup.py +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/setup.py @@ -49,15 +49,14 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "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, @@ -74,10 +73,10 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.7", + python_requires=">=3.9", ) diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/tsp-location.yaml b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/tsp-location.yaml new file mode 100644 index 000000000000..d4d1c045dbcb --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/recoveryservicesdatareplication/DataReplication.Management +commit: f3e94891900321971792a261c58d9775340c6269 +repo: Azure/azure-rest-api-specs +additionalDirectories: