From 955b66f6f4a613183733af46d14766f3e2e5e9b9 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Mon, 6 Jul 2026 08:27:43 +0000 Subject: [PATCH 1/5] Configurations: 'specification/elastic/Elastic.Management/tspconfig.yaml', API Version: 2025-06-01, SDK Release Type: beta, and CommitSHA: '3d1de464b5576fa149aed429795f6030313e31bb' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6522460 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/elastic/azure-mgmt-elastic/CHANGELOG.md | 34 + sdk/elastic/azure-mgmt-elastic/README.md | 10 +- sdk/elastic/azure-mgmt-elastic/_metadata.json | 16 +- sdk/elastic/azure-mgmt-elastic/api.md | 3512 +++++++++ .../azure-mgmt-elastic/api.metadata.yml | 3 + .../apiview-properties.json | 333 +- .../azure/mgmt/elastic/__init__.py | 6 +- .../{_microsoft_elastic.py => _client.py} | 98 +- .../azure/mgmt/elastic/_configuration.py | 17 +- .../azure/mgmt/elastic/_patch.py | 13 +- .../azure/mgmt/elastic/_utils/__init__.py | 2 +- .../azure/mgmt/elastic/_utils/model_base.py | 1770 +++++ .../mgmt/elastic/_utils/serialization.py | 157 +- .../azure/mgmt/elastic/_version.py | 4 +- .../azure/mgmt/elastic/aio/__init__.py | 6 +- .../aio/{_microsoft_elastic.py => _client.py} | 98 +- .../azure/mgmt/elastic/aio/_configuration.py | 17 +- .../azure/mgmt/elastic/aio/_patch.py | 13 +- .../mgmt/elastic/aio/operations/__init__.py | 64 +- .../_all_traffic_filters_operations.py | 117 - .../_associate_traffic_filter_operations.py | 175 - .../operations/_billing_info_operations.py | 115 - ..._connected_partner_resources_operations.py | 147 - ...eate_and_associate_ip_filter_operations.py | 189 - ...eate_and_associate_pl_filter_operations.py | 195 - .../operations/_deployment_info_operations.py | 115 - ...ch_and_delete_traffic_filter_operations.py | 116 - .../_detach_traffic_filter_operations.py | 175 - .../_elastic_versions_operations.py | 141 - .../operations/_external_user_operations.py | 203 - ...t_associated_traffic_filters_operations.py | 117 - .../aio/operations/_monitor_operations.py | 263 - .../_monitored_resources_operations.py | 145 - .../_monitored_subscriptions_operations.py | 794 -- .../aio/operations/_monitors_operations.py | 841 -- .../aio/operations/_open_ai_operations.py | 507 -- .../elastic/aio/operations/_operations.py | 5833 +++++++++++++- .../operations/_organizations_operations.py | 449 -- .../mgmt/elastic/aio/operations/_patch.py | 13 +- .../aio/operations/_tag_rules_operations.py | 496 -- .../operations/_traffic_filters_operations.py | 116 - .../_upgradable_versions_operations.py | 117 - .../operations/_vm_collection_operations.py | 199 - .../aio/operations/_vm_host_operations.py | 143 - .../operations/_vm_ingestion_operations.py | 117 - .../azure/mgmt/elastic/models/__init__.py | 30 +- ...{_microsoft_elastic_enums.py => _enums.py} | 53 +- .../azure/mgmt/elastic/models/_models.py | 2459 ++++++ .../azure/mgmt/elastic/models/_models_py3.py | 2646 ------- .../azure/mgmt/elastic/models/_patch.py | 13 +- .../azure/mgmt/elastic/operations/__init__.py | 64 +- .../_all_traffic_filters_operations.py | 149 - .../_associate_traffic_filter_operations.py | 218 - .../operations/_billing_info_operations.py | 149 - ..._connected_partner_resources_operations.py | 181 - ...eate_and_associate_ip_filter_operations.py | 235 - ...eate_and_associate_pl_filter_operations.py | 244 - .../operations/_deployment_info_operations.py | 149 - ...ch_and_delete_traffic_filter_operations.py | 159 - .../_detach_traffic_filter_operations.py | 218 - .../_elastic_versions_operations.py | 167 - .../operations/_external_user_operations.py | 242 - ...t_associated_traffic_filters_operations.py | 149 - .../elastic/operations/_monitor_operations.py | 302 - .../_monitored_resources_operations.py | 179 - .../_monitored_subscriptions_operations.py | 963 --- .../operations/_monitors_operations.py | 1023 --- .../elastic/operations/_open_ai_operations.py | 674 -- .../mgmt/elastic/operations/_operations.py | 6975 ++++++++++++++++- .../operations/_organizations_operations.py | 542 -- .../azure/mgmt/elastic/operations/_patch.py | 13 +- .../operations/_tag_rules_operations.py | 629 -- .../operations/_traffic_filters_operations.py | 159 - .../_upgradable_versions_operations.py | 151 - .../operations/_vm_collection_operations.py | 238 - .../elastic/operations/_vm_host_operations.py | 177 - .../operations/_vm_ingestion_operations.py | 151 - .../azure/mgmt/elastic/types.py | 1331 ++++ .../all_traffic_filters_list.py | 11 +- .../associate_traffic_filter_update.py | 11 +- .../associated_filters_for_deployment_list.py | 11 +- .../generated_samples/billing_info_get.py | 11 +- .../connected_partner_resources_list.py | 11 +- .../generated_samples/deployment_info_list.py | 11 +- ...detach_and_delete_traffic_filter_delete.py | 11 +- .../detach_traffic_filters_update.py | 11 +- .../elastic_versions_list.py | 11 +- .../generated_samples/external_user_info.py | 11 +- .../ip_traffic_filter_create.py | 11 +- .../generated_samples/monitor_upgrade.py | 11 +- .../monitored_resources_list.py | 11 +- ...monitored_subscriptions_createor_update.py | 11 +- .../monitored_subscriptions_delete.py | 11 +- .../monitored_subscriptions_get.py | 11 +- .../monitored_subscriptions_list.py | 11 +- .../monitored_subscriptions_update.py | 11 +- .../generated_samples/monitors_create.py | 11 +- .../generated_samples/monitors_delete.py | 11 +- .../generated_samples/monitors_get.py | 11 +- .../generated_samples/monitors_list.py | 11 +- .../monitors_list_by_resource_group.py | 11 +- .../generated_samples/monitors_update.py | 11 +- .../open_ai_create_or_update.py | 11 +- .../generated_samples/open_ai_delete.py | 11 +- .../generated_samples/open_ai_get.py | 11 +- .../generated_samples/open_ai_get_status.py | 11 +- .../generated_samples/open_ai_list.py | 11 +- .../generated_samples/operations_list.py | 9 +- .../organizations_get_api_key.py | 11 +- ...t_elastic_to_azure_subscription_mapping.py | 11 +- .../organizations_resubscribe.py | 11 +- .../private_link_traffic_filters_create.py | 11 +- .../tag_rules_create_or_update.py | 11 +- .../generated_samples/tag_rules_delete.py | 11 +- .../generated_samples/tag_rules_get.py | 11 +- .../generated_samples/tag_rules_list.py | 11 +- .../traffic_filters_delete.py | 11 +- .../upgradable_versions_details.py | 11 +- .../generated_samples/vm_collection_update.py | 11 +- .../generated_samples/vm_host_list.py | 11 +- .../generated_samples/vm_ingestion_details.py | 11 +- .../generated_tests/conftest.py | 18 +- ...ic_mgmt_all_traffic_filters_operations.py} | 9 +- ...t_all_traffic_filters_operations_async.py} | 9 +- ...mt_associate_traffic_filter_operations.py} | 9 +- ...ociate_traffic_filter_operations_async.py} | 9 +- ...t_elastic_mgmt_billing_info_operations.py} | 9 +- ...tic_mgmt_billing_info_operations_async.py} | 9 +- ...connected_partner_resources_operations.py} | 9 +- ...ted_partner_resources_operations_async.py} | 9 +- ...lastic_mgmt_deployment_info_operations.py} | 9 +- ..._mgmt_deployment_info_operations_async.py} | 9 +- ...h_and_delete_traffic_filter_operations.py} | 9 +- ...delete_traffic_filter_operations_async.py} | 9 +- ..._mgmt_detach_traffic_filter_operations.py} | 9 +- ...detach_traffic_filter_operations_async.py} | 9 +- ...astic_mgmt_elastic_versions_operations.py} | 9 +- ...mgmt_elastic_versions_operations_async.py} | 9 +- ..._elastic_mgmt_external_user_operations.py} | 9 +- ...ic_mgmt_external_user_operations_async.py} | 9 +- ...> test_elastic_mgmt_monitor_operations.py} | 9 +- ..._elastic_mgmt_monitor_operations_async.py} | 9 +- ...ic_mgmt_monitored_resources_operations.py} | 9 +- ...t_monitored_resources_operations_async.py} | 9 +- ...gmt_monitored_subscriptions_operations.py} | 35 +- ...nitored_subscriptions_operations_async.py} | 35 +- ... test_elastic_mgmt_monitors_operations.py} | 51 +- ...elastic_mgmt_monitors_operations_async.py} | 51 +- ...> test_elastic_mgmt_open_ai_operations.py} | 35 +- ..._elastic_mgmt_open_ai_operations_async.py} | 35 +- ...ons.py => test_elastic_mgmt_operations.py} | 12 +- ... => test_elastic_mgmt_operations_async.py} | 12 +- ..._elastic_mgmt_organizations_operations.py} | 31 +- ...ic_mgmt_organizations_operations_async.py} | 35 +- ...test_elastic_mgmt_tag_rules_operations.py} | 34 +- ...lastic_mgmt_tag_rules_operations_async.py} | 42 +- ...lastic_mgmt_traffic_filters_operations.py} | 9 +- ..._mgmt_traffic_filters_operations_async.py} | 9 +- ...ic_mgmt_upgradable_versions_operations.py} | 9 +- ...t_upgradable_versions_operations_async.py} | 9 +- ..._elastic_mgmt_vm_collection_operations.py} | 9 +- ...ic_mgmt_vm_collection_operations_async.py} | 9 +- ...> test_elastic_mgmt_vm_host_operations.py} | 9 +- ..._elastic_mgmt_vm_host_operations_async.py} | 9 +- ...t_elastic_mgmt_vm_ingestion_operations.py} | 9 +- ...tic_mgmt_vm_ingestion_operations_async.py} | 9 +- ...ate_and_associate_ip_filter_operations.py} | 9 +- ...d_associate_ip_filter_operations_async.py} | 9 +- ...ate_and_associate_pl_filter_operations.py} | 9 +- ...d_associate_pl_filter_operations_async.py} | 9 +- ..._associated_traffic_filters_operations.py} | 9 +- ...iated_traffic_filters_operations_async.py} | 9 +- sdk/elastic/azure-mgmt-elastic/pyproject.toml | 12 +- .../azure-mgmt-elastic/tsp-location.yaml | 4 + 174 files changed, 23047 insertions(+), 17251 deletions(-) create mode 100644 sdk/elastic/azure-mgmt-elastic/api.md create mode 100644 sdk/elastic/azure-mgmt-elastic/api.metadata.yml rename sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/{_microsoft_elastic.py => _client.py} (84%) create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/model_base.py rename sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/{_microsoft_elastic.py => _client.py} (85%) delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_billing_info_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_connected_partner_resources_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_elastic_versions_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_subscriptions_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_open_ai_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py rename sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/{_microsoft_elastic_enums.py => _enums.py} (74%) create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_billing_info_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_connected_partner_resources_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_elastic_versions_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_subscriptions_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_open_ai_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/types.py rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_all_traffic_filters_operations.py => test_elastic_mgmt_all_traffic_filters_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_all_traffic_filters_operations_async.py => test_elastic_mgmt_all_traffic_filters_operations_async.py} (77%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_associate_traffic_filter_operations.py => test_elastic_mgmt_associate_traffic_filter_operations.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_associate_traffic_filter_operations_async.py => test_elastic_mgmt_associate_traffic_filter_operations_async.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_billing_info_operations.py => test_elastic_mgmt_billing_info_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_billing_info_operations_async.py => test_elastic_mgmt_billing_info_operations_async.py} (77%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_connected_partner_resources_operations.py => test_elastic_mgmt_connected_partner_resources_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_connected_partner_resources_operations_async.py => test_elastic_mgmt_connected_partner_resources_operations_async.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_deployment_info_operations.py => test_elastic_mgmt_deployment_info_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_deployment_info_operations_async.py => test_elastic_mgmt_deployment_info_operations_async.py} (77%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_detach_and_delete_traffic_filter_operations.py => test_elastic_mgmt_detach_and_delete_traffic_filter_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_detach_and_delete_traffic_filter_operations_async.py => test_elastic_mgmt_detach_and_delete_traffic_filter_operations_async.py} (77%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_detach_traffic_filter_operations.py => test_elastic_mgmt_detach_traffic_filter_operations.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_detach_traffic_filter_operations_async.py => test_elastic_mgmt_detach_traffic_filter_operations_async.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_elastic_versions_operations.py => test_elastic_mgmt_elastic_versions_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_elastic_versions_operations_async.py => test_elastic_mgmt_elastic_versions_operations_async.py} (77%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_external_user_operations.py => test_elastic_mgmt_external_user_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_external_user_operations_async.py => test_elastic_mgmt_external_user_operations_async.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_monitor_operations.py => test_elastic_mgmt_monitor_operations.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_monitor_operations_async.py => test_elastic_mgmt_monitor_operations_async.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_monitored_resources_operations.py => test_elastic_mgmt_monitored_resources_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_monitored_resources_operations_async.py => test_elastic_mgmt_monitored_resources_operations_async.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_monitored_subscriptions_operations.py => test_elastic_mgmt_monitored_subscriptions_operations.py} (87%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_monitored_subscriptions_operations_async.py => test_elastic_mgmt_monitored_subscriptions_operations_async.py} (87%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_monitors_operations.py => test_elastic_mgmt_monitors_operations.py} (84%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_monitors_operations_async.py => test_elastic_mgmt_monitors_operations_async.py} (85%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_open_ai_operations.py => test_elastic_mgmt_open_ai_operations.py} (85%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_open_ai_operations_async.py => test_elastic_mgmt_open_ai_operations_async.py} (85%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_operations.py => test_elastic_mgmt_operations.py} (73%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_operations_async.py => test_elastic_mgmt_operations_async.py} (73%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_organizations_operations.py => test_elastic_mgmt_organizations_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_organizations_operations_async.py => test_elastic_mgmt_organizations_operations_async.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_tag_rules_operations.py => test_elastic_mgmt_tag_rules_operations.py} (85%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_tag_rules_operations_async.py => test_elastic_mgmt_tag_rules_operations_async.py} (85%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_traffic_filters_operations.py => test_elastic_mgmt_traffic_filters_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_traffic_filters_operations_async.py => test_elastic_mgmt_traffic_filters_operations_async.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_upgradable_versions_operations.py => test_elastic_mgmt_upgradable_versions_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_upgradable_versions_operations_async.py => test_elastic_mgmt_upgradable_versions_operations_async.py} (77%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_vm_collection_operations.py => test_elastic_mgmt_vm_collection_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_vm_collection_operations_async.py => test_elastic_mgmt_vm_collection_operations_async.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_vm_host_operations.py => test_elastic_mgmt_vm_host_operations.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_vm_host_operations_async.py => test_elastic_mgmt_vm_host_operations_async.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_vm_ingestion_operations.py => test_elastic_mgmt_vm_ingestion_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_vm_ingestion_operations_async.py => test_elastic_mgmt_vm_ingestion_operations_async.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_create_and_associate_ip_filter_operations.py => test_elastic_mgmtcreate_and_associate_ip_filter_operations.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_create_and_associate_ip_filter_operations_async.py => test_elastic_mgmtcreate_and_associate_ip_filter_operations_async.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_create_and_associate_pl_filter_operations.py => test_elastic_mgmtcreate_and_associate_pl_filter_operations.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_create_and_associate_pl_filter_operations_async.py => test_elastic_mgmtcreate_and_associate_pl_filter_operations_async.py} (79%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_list_associated_traffic_filters_operations.py => test_elastic_mgmtlist_associated_traffic_filters_operations.py} (78%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_microsoft_elastic_list_associated_traffic_filters_operations_async.py => test_elastic_mgmtlist_associated_traffic_filters_operations_async.py} (77%) create mode 100644 sdk/elastic/azure-mgmt-elastic/tsp-location.yaml diff --git a/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md b/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md index 29d55afce2b6..bc35d15a476a 100644 --- a/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md +++ b/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md @@ -1,5 +1,39 @@ # Release History +## 3.0.0b1 (2026-07-06) + +### Features Added + + - Model `MonitoredSubscriptionProperties` added property `system_data` + - Model `OpenAIIntegrationRPModel` added property `system_data` + - Added model `ProxyResource` + - Added model `Resource` + - Added model `TrackedResource` + - Added model `createAndAssociateIPFilterOperations` + - Added model `createAndAssociatePLFilterOperations` + - Added model `listAssociatedTrafficFiltersOperations` + +### Breaking Changes + + - Deleted or renamed model `MicrosoftElastic` + - Deleted or renamed model `ConnectedPartnerResourcesListResponse` + - Deleted or renamed model `ElasticMonitorResourceListResponse` + - Deleted or renamed model `ElasticVersionsListResponse` + - Deleted or renamed model `MonitoredResourceListResponse` + - Deleted or renamed model `MonitoredSubscriptionPropertiesList` + - Deleted or renamed model `MonitoringTagRulesListResponse` + - Deleted or renamed model `OpenAIIntegrationRPModelListResponse` + - Deleted or renamed model `OperationListResult` + - Deleted or renamed model `VMHostListResponse` + - Method `AssociateTrafficFilterOperations.begin_associate` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` + - Method `DetachAndDeleteTrafficFilterOperations.delete` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` + - Method `DetachTrafficFilterOperations.begin_update` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` + - Method `ElasticVersionsOperations.list` changed its parameter `region` from `positional_or_keyword` to `keyword_only` + - Method `TrafficFiltersOperations.delete` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` + - Deleted or renamed model `CreateAndAssociateIPFilterOperations` + - Deleted or renamed model `CreateAndAssociatePLFilterOperations` + - Deleted or renamed model `ListAssociatedTrafficFiltersOperations` + ## 2.0.0 (2025-11-17) ### Features Added diff --git a/sdk/elastic/azure-mgmt-elastic/README.md b/sdk/elastic/azure-mgmt-elastic/README.md index 12b63a231f5b..83b999398d69 100644 --- a/sdk/elastic/azure-mgmt-elastic/README.md +++ b/sdk/elastic/azure-mgmt-elastic/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Elastic Management Client Library. -This package has been tested with Python 3.9+. +This package has been tested with Python 3.10+. 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.9+ is required to use this package. +- Python 3.10+ 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 configuration of the following environment variables. +By default, [Microsoft Entra](https://learn.microsoft.com/entra/fundamentals/what-is-entra) 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. @@ -36,11 +36,11 @@ With above configuration, client can be authenticated by following code: ```python from azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient import os sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") -client = MicrosoftElastic(credential=DefaultAzureCredential(), subscription_id=sub_id) +client = ElasticMgmtClient(credential=DefaultAzureCredential(), subscription_id=sub_id) ``` ## Examples diff --git a/sdk/elastic/azure-mgmt-elastic/_metadata.json b/sdk/elastic/azure-mgmt-elastic/_metadata.json index 4837c37facfc..49ccf9664c1c 100644 --- a/sdk/elastic/azure-mgmt-elastic/_metadata.json +++ b/sdk/elastic/azure-mgmt-elastic/_metadata.json @@ -1,11 +1,11 @@ { - "commit": "22ae5674fc98c32b29fb60791bd51a8fbd41b25f", + "apiVersion": "2025-06-01", + "apiVersions": { + "Microsoft.Elastic": "2025-06-01" + }, + "commit": "3d1de464b5576fa149aed429795f6030313e31bb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.41.3", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/elastic/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.41.3 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/elastic/resource-manager/readme.md" + "typespec_src": "specification/elastic/Elastic.Management", + "emitterVersion": "0.63.2", + "httpClientPythonVersion": "^0.34.0" } \ No newline at end of file diff --git a/sdk/elastic/azure-mgmt-elastic/api.md b/sdk/elastic/azure-mgmt-elastic/api.md new file mode 100644 index 000000000000..acce32ee5858 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/api.md @@ -0,0 +1,3512 @@ +```py +namespace azure.mgmt.elastic + + class azure.mgmt.elastic.ElasticMgmtClient: implements ContextManager + all_traffic_filters: AllTrafficFiltersOperations + associate_traffic_filter: AssociateTrafficFilterOperations + billing_info: BillingInfoOperations + connected_partner_resources: ConnectedPartnerResourcesOperations + create_and_associate_ip_filter: createAndAssociateIPFilterOperations + create_and_associate_pl_filter: createAndAssociatePLFilterOperations + deployment_info: DeploymentInfoOperations + detach_and_delete_traffic_filter: DetachAndDeleteTrafficFilterOperations + detach_traffic_filter: DetachTrafficFilterOperations + elastic_versions: ElasticVersionsOperations + external_user: ExternalUserOperations + list_associated_traffic_filters: listAssociatedTrafficFiltersOperations + monitor: MonitorOperations + monitored_resources: MonitoredResourcesOperations + monitored_subscriptions: MonitoredSubscriptionsOperations + monitors: MonitorsOperations + open_ai: OpenAIOperations + operations: Operations + organizations: OrganizationsOperations + tag_rules: TagRulesOperations + traffic_filters: TrafficFiltersOperations + upgradable_versions: UpgradableVersionsOperations + vm_collection: VMCollectionOperations + vm_host: VMHostOperations + vm_ingestion: VMIngestionOperations + + def __init__( + self, + credential: TokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + def close(self) -> None: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> HttpResponse: ... + + +namespace azure.mgmt.elastic.aio + + class azure.mgmt.elastic.aio.ElasticMgmtClient: implements AsyncContextManager + all_traffic_filters: AllTrafficFiltersOperations + associate_traffic_filter: AssociateTrafficFilterOperations + billing_info: BillingInfoOperations + connected_partner_resources: ConnectedPartnerResourcesOperations + create_and_associate_ip_filter: createAndAssociateIPFilterOperations + create_and_associate_pl_filter: createAndAssociatePLFilterOperations + deployment_info: DeploymentInfoOperations + detach_and_delete_traffic_filter: DetachAndDeleteTrafficFilterOperations + detach_traffic_filter: DetachTrafficFilterOperations + elastic_versions: ElasticVersionsOperations + external_user: ExternalUserOperations + list_associated_traffic_filters: listAssociatedTrafficFiltersOperations + monitor: MonitorOperations + monitored_resources: MonitoredResourcesOperations + monitored_subscriptions: MonitoredSubscriptionsOperations + monitors: MonitorsOperations + open_ai: OpenAIOperations + operations: Operations + organizations: OrganizationsOperations + tag_rules: TagRulesOperations + traffic_filters: TrafficFiltersOperations + upgradable_versions: UpgradableVersionsOperations + vm_collection: VMCollectionOperations + vm_host: VMHostOperations + vm_ingestion: VMIngestionOperations + + def __init__( + self, + credential: AsyncTokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + async def close(self) -> None: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: ... + + +namespace azure.mgmt.elastic.aio.operations + + class azure.mgmt.elastic.aio.operations.AllTrafficFiltersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ElasticTrafficFilterResponse: ... + + + class azure.mgmt.elastic.aio.operations.AssociateTrafficFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def begin_associate( + self, + resource_group_name: str, + monitor_name: str, + *, + ruleset_id: Optional[str] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + + class azure.mgmt.elastic.aio.operations.BillingInfoOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> BillingInfoResponse: ... + + + class azure.mgmt.elastic.aio.operations.ConnectedPartnerResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ConnectedPartnerResourcesListFormat]: ... + + + class azure.mgmt.elastic.aio.operations.DeploymentInfoOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> DeploymentInfoResponse: ... + + + class azure.mgmt.elastic.aio.operations.DetachAndDeleteTrafficFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + monitor_name: str, + *, + ruleset_id: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.elastic.aio.operations.DetachTrafficFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + *, + ruleset_id: Optional[str] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + + class azure.mgmt.elastic.aio.operations.ElasticVersionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + *, + region: str, + **kwargs: Any + ) -> AsyncItemPaged[ElasticVersionListFormat]: ... + + + class azure.mgmt.elastic.aio.operations.ExternalUserOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ExternalUserInfo] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ExternalUserCreationResponse: ... + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ExternalUserInfo] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ExternalUserCreationResponse: ... + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ExternalUserCreationResponse: ... + + + class azure.mgmt.elastic.aio.operations.MonitorOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorUpgrade] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorUpgrade] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + + class azure.mgmt.elastic.aio.operations.MonitoredResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncItemPaged[MonitoredResource]: ... + + + class azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[MonitoredSubscriptionProperties]: ... + + @overload + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[MonitoredSubscriptionProperties]: ... + + @overload + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[MonitoredSubscriptionProperties]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[MonitoredSubscriptionProperties]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[MonitoredSubscriptionProperties]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[MonitoredSubscriptionProperties]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + **kwargs: Any + ) -> MonitoredSubscriptionProperties: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncItemPaged[MonitoredSubscriptionProperties]: ... + + + class azure.mgmt.elastic.aio.operations.MonitorsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ElasticMonitorResource]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ElasticMonitorResource]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ElasticMonitorResource]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorResourceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ElasticMonitorResource]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorResourceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ElasticMonitorResource]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ElasticMonitorResource]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ElasticMonitorResource: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[ElasticMonitorResource]: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ElasticMonitorResource]: ... + + + class azure.mgmt.elastic.aio.operations.OpenAIOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> OpenAIIntegrationRPModel: ... + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> OpenAIIntegrationRPModel: ... + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> OpenAIIntegrationRPModel: ... + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + **kwargs: Any + ) -> OpenAIIntegrationRPModel: ... + + @distributed_trace_async + async def get_status( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + **kwargs: Any + ) -> OpenAIIntegrationStatusResponse: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncItemPaged[OpenAIIntegrationRPModel]: ... + + + class azure.mgmt.elastic.aio.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[OperationResult]: ... + + + class azure.mgmt.elastic.aio.operations.OrganizationsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ResubscribeProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ElasticMonitorResource]: ... + + @overload + async def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ResubscribeProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ElasticMonitorResource]: ... + + @overload + async def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ElasticMonitorResource]: ... + + @overload + async def get_api_key( + self, + body: Optional[UserEmailId] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> UserApiKeyResponse: ... + + @overload + async def get_api_key( + self, + body: Optional[UserEmailId] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> UserApiKeyResponse: ... + + @overload + async def get_api_key( + self, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> UserApiKeyResponse: ... + + @distributed_trace_async + async def get_elastic_to_azure_subscription_mapping(self, **kwargs: Any) -> ElasticOrganizationToAzureSubscriptionMappingResponse: ... + + + class azure.mgmt.elastic.aio.operations.TagRulesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[MonitoringTagRules] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MonitoringTagRules: ... + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[MonitoringTagRules] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MonitoringTagRules: ... + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MonitoringTagRules: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> MonitoringTagRules: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncItemPaged[MonitoringTagRules]: ... + + + class azure.mgmt.elastic.aio.operations.TrafficFiltersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + monitor_name: str, + *, + ruleset_id: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.elastic.aio.operations.UpgradableVersionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def details( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> UpgradableVersionsList: ... + + + class azure.mgmt.elastic.aio.operations.VMCollectionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[VMCollectionUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[VMCollectionUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.elastic.aio.operations.VMHostOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncItemPaged[VMResources]: ... + + + class azure.mgmt.elastic.aio.operations.VMIngestionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def details( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> VMIngestionDetailsResponse: ... + + + class azure.mgmt.elastic.aio.operations.createAndAssociateIPFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + ips: Optional[str] = ..., + name: Optional[str] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + + class azure.mgmt.elastic.aio.operations.createAndAssociatePLFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + name: Optional[str] = ..., + private_endpoint_guid: Optional[str] = ..., + private_endpoint_name: Optional[str] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + + class azure.mgmt.elastic.aio.operations.listAssociatedTrafficFiltersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ElasticTrafficFilterResponse: ... + + +namespace azure.mgmt.elastic.models + + class azure.mgmt.elastic.models.BillingInfoResponse(_Model): + marketplace_saas_info: Optional[MarketplaceSaaSInfo] + partner_billing_entity: Optional[PartnerBillingEntity] + + @overload + def __init__( + self, + *, + marketplace_saas_info: Optional[MarketplaceSaaSInfo] = ..., + partner_billing_entity: Optional[PartnerBillingEntity] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.CompanyInfo(_Model): + business: Optional[str] + country: Optional[str] + domain: Optional[str] + employees_number: Optional[str] + state: Optional[str] + + @overload + def __init__( + self, + *, + business: Optional[str] = ..., + country: Optional[str] = ..., + domain: Optional[str] = ..., + employees_number: Optional[str] = ..., + state: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + GENERAL_PURPOSE = "GeneralPurpose" + NOT_APPLICABLE = "NotApplicable" + TIME_SERIES = "TimeSeries" + VECTOR = "Vector" + + + class azure.mgmt.elastic.models.ConnectedPartnerResourceProperties(_Model): + azure_resource_id: Optional[str] + location: Optional[str] + partner_deployment_name: Optional[str] + partner_deployment_uri: Optional[str] + type: Optional[str] + + @overload + def __init__( + self, + *, + azure_resource_id: Optional[str] = ..., + location: Optional[str] = ..., + partner_deployment_name: Optional[str] = ..., + partner_deployment_uri: Optional[str] = ..., + type: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat(_Model): + properties: Optional[ConnectedPartnerResourceProperties] + + @overload + def __init__( + self, + *, + properties: Optional[ConnectedPartnerResourceProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + APPLICATION = "Application" + KEY = "Key" + MANAGED_IDENTITY = "ManagedIdentity" + USER = "User" + + + class azure.mgmt.elastic.models.DeploymentInfoResponse(_Model): + configuration_type: Optional[str] + deployment_url: Optional[str] + disk_capacity: Optional[str] + elasticsearch_end_point: Optional[str] + marketplace_saas_info: Optional[MarketplaceSaaSInfo] + memory_capacity: Optional[str] + project_type: Optional[str] + status: Optional[Union[str, ElasticDeploymentStatus]] + version: Optional[str] + + + class azure.mgmt.elastic.models.ElasticCloudDeployment(_Model): + azure_subscription_id: Optional[str] + deployment_id: Optional[str] + elasticsearch_region: Optional[str] + elasticsearch_service_url: Optional[str] + kibana_service_url: Optional[str] + kibana_sso_url: Optional[str] + name: Optional[str] + + + class azure.mgmt.elastic.models.ElasticCloudUser(_Model): + elastic_cloud_sso_default_url: Optional[str] + email_address: Optional[str] + id: Optional[str] + + + class azure.mgmt.elastic.models.ElasticDeploymentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + HEALTHY = "Healthy" + UNHEALTHY = "Unhealthy" + + + class azure.mgmt.elastic.models.ElasticMonitorResource(TrackedResource): + id: str + identity: Optional[IdentityProperties] + kind: Optional[str] + location: str + name: str + properties: Optional[MonitorProperties] + sku: Optional[ResourceSku] + system_data: SystemData + tags: dict[str, str] + type: str + + @overload + def __init__( + self, + *, + identity: Optional[IdentityProperties] = ..., + kind: Optional[str] = ..., + location: str, + properties: Optional[MonitorProperties] = ..., + sku: Optional[ResourceSku] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters(_Model): + tags: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticMonitorUpgrade(_Model): + version: Optional[str] + + @overload + def __init__( + self, + *, + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse(_Model): + properties: Optional[ElasticOrganizationToAzureSubscriptionMappingResponseProperties] + + @overload + def __init__( + self, + *, + properties: Optional[ElasticOrganizationToAzureSubscriptionMappingResponseProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties(_Model): + billed_azure_subscription_id: Optional[str] + elastic_organization_id: Optional[str] + elastic_organization_name: Optional[str] + marketplace_saas_info: Optional[MarketplaceSaaSInfo] + + @overload + def __init__( + self, + *, + billed_azure_subscription_id: Optional[str] = ..., + elastic_organization_id: Optional[str] = ..., + elastic_organization_name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticProperties(_Model): + elastic_cloud_deployment: Optional[ElasticCloudDeployment] + elastic_cloud_user: Optional[ElasticCloudUser] + + @overload + def __init__( + self, + *, + elastic_cloud_deployment: Optional[ElasticCloudDeployment] = ..., + elastic_cloud_user: Optional[ElasticCloudUser] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticTrafficFilter(_Model): + description: Optional[str] + id: Optional[str] + include_by_default: Optional[bool] + name: Optional[str] + region: Optional[str] + rules: Optional[list[ElasticTrafficFilterRule]] + type: Optional[Union[str, Type]] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + id: Optional[str] = ..., + include_by_default: Optional[bool] = ..., + name: Optional[str] = ..., + region: Optional[str] = ..., + rules: Optional[list[ElasticTrafficFilterRule]] = ..., + type: Optional[Union[str, Type]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticTrafficFilterResponse(_Model): + rulesets: Optional[list[ElasticTrafficFilter]] + + @overload + def __init__( + self, + *, + rulesets: Optional[list[ElasticTrafficFilter]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticTrafficFilterRule(_Model): + azure_endpoint_guid: Optional[str] + azure_endpoint_name: Optional[str] + description: Optional[str] + id: Optional[str] + source: Optional[str] + + @overload + def __init__( + self, + *, + azure_endpoint_guid: Optional[str] = ..., + azure_endpoint_name: Optional[str] = ..., + description: Optional[str] = ..., + id: Optional[str] = ..., + source: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticVersionListFormat(_Model): + properties: Optional[ElasticVersionListProperties] + + @overload + def __init__( + self, + *, + properties: Optional[ElasticVersionListProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ElasticVersionListProperties(_Model): + version: Optional[str] + + @overload + def __init__( + self, + *, + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ErrorAdditionalInfo(_Model): + info: Optional[Any] + type: Optional[str] + + + class azure.mgmt.elastic.models.ErrorDetail(_Model): + additional_info: Optional[list[ErrorAdditionalInfo]] + code: Optional[str] + details: Optional[list[ErrorDetail]] + message: Optional[str] + target: Optional[str] + + + class azure.mgmt.elastic.models.ErrorResponse(_Model): + error: Optional[ErrorDetail] + + @overload + def __init__( + self, + *, + error: Optional[ErrorDetail] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ErrorResponseBody(_Model): + code: Optional[str] + details: Optional[list[ErrorResponseBody]] + message: Optional[str] + target: Optional[str] + + @overload + def __init__( + self, + *, + code: Optional[str] = ..., + details: Optional[list[ErrorResponseBody]] = ..., + message: Optional[str] = ..., + target: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ExternalUserCreationResponse(_Model): + created: Optional[bool] + + + class azure.mgmt.elastic.models.ExternalUserInfo(_Model): + email_id: Optional[str] + full_name: Optional[str] + password: Optional[str] + roles: Optional[list[str]] + user_name: Optional[str] + + @overload + def __init__( + self, + *, + email_id: Optional[str] = ..., + full_name: Optional[str] = ..., + password: Optional[str] = ..., + roles: Optional[list[str]] = ..., + user_name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.FilteringTag(_Model): + action: Optional[Union[str, TagAction]] + name: Optional[str] + value: Optional[str] + + @overload + def __init__( + self, + *, + action: Optional[Union[str, TagAction]] = ..., + name: Optional[str] = ..., + value: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.HostingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + HOSTED = "Hosted" + SERVERLESS = "Serverless" + + + class azure.mgmt.elastic.models.IdentityProperties(_Model): + principal_id: Optional[str] + tenant_id: Optional[str] + type: Optional[Union[str, ManagedIdentityTypes]] + + @overload + def __init__( + self, + *, + type: Optional[Union[str, ManagedIdentityTypes]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.LiftrResourceCategories(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MONITOR_LOGS = "MonitorLogs" + UNKNOWN = "Unknown" + + + class azure.mgmt.elastic.models.LogRules(_Model): + filtering_tags: Optional[list[FilteringTag]] + send_aad_logs: Optional[bool] + send_activity_logs: Optional[bool] + send_subscription_logs: Optional[bool] + + @overload + def __init__( + self, + *, + filtering_tags: Optional[list[FilteringTag]] = ..., + send_aad_logs: Optional[bool] = ..., + send_activity_logs: Optional[bool] = ..., + send_subscription_logs: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ManagedIdentityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SYSTEM_ASSIGNED = "SystemAssigned" + + + class azure.mgmt.elastic.models.MarketplaceSaaSInfo(_Model): + billed_azure_subscription_id: Optional[str] + marketplace_name: Optional[str] + marketplace_resource_id: Optional[str] + marketplace_status: Optional[str] + marketplace_subscription: Optional[MarketplaceSaaSInfoMarketplaceSubscription] + subscribed: Optional[bool] + + @overload + def __init__( + self, + *, + billed_azure_subscription_id: Optional[str] = ..., + marketplace_name: Optional[str] = ..., + marketplace_resource_id: Optional[str] = ..., + marketplace_status: Optional[str] = ..., + marketplace_subscription: Optional[MarketplaceSaaSInfoMarketplaceSubscription] = ..., + subscribed: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription(_Model): + id: Optional[str] + offer_id: Optional[str] + publisher_id: Optional[str] + + @overload + def __init__( + self, + *, + id: Optional[str] = ..., + offer_id: Optional[str] = ..., + publisher_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.MonitorProperties(_Model): + elastic_properties: Optional[ElasticProperties] + generate_api_key: Optional[bool] + hosting_type: Optional[Union[str, HostingType]] + liftr_resource_category: Optional[Union[str, LiftrResourceCategories]] + liftr_resource_preference: Optional[int] + monitoring_status: Optional[Union[str, MonitoringStatus]] + plan_details: Optional[PlanDetails] + project_details: Optional[ProjectDetails] + provisioning_state: Optional[Union[str, ProvisioningState]] + saa_s_azure_subscription_status: Optional[str] + source_campaign_id: Optional[str] + source_campaign_name: Optional[str] + subscription_state: Optional[str] + user_info: Optional[UserInfo] + version: Optional[str] + + @overload + def __init__( + self, + *, + elastic_properties: Optional[ElasticProperties] = ..., + generate_api_key: Optional[bool] = ..., + hosting_type: Optional[Union[str, HostingType]] = ..., + monitoring_status: Optional[Union[str, MonitoringStatus]] = ..., + plan_details: Optional[PlanDetails] = ..., + project_details: Optional[ProjectDetails] = ..., + saa_s_azure_subscription_status: Optional[str] = ..., + source_campaign_id: Optional[str] = ..., + source_campaign_name: Optional[str] = ..., + subscription_state: Optional[str] = ..., + user_info: Optional[UserInfo] = ..., + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.MonitoredResource(_Model): + id: Optional[str] + reason_for_logs_status: Optional[str] + sending_logs: Optional[Union[str, SendingLogs]] + + @overload + def __init__( + self, + *, + id: Optional[str] = ..., + reason_for_logs_status: Optional[str] = ..., + sending_logs: Optional[Union[str, SendingLogs]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.MonitoredSubscription(_Model): + error: Optional[str] + status: Optional[Union[str, Status]] + subscription_id: str + tag_rules: Optional[MonitoringTagRulesProperties] + + @overload + def __init__( + self, + *, + error: Optional[str] = ..., + status: Optional[Union[str, Status]] = ..., + subscription_id: str, + tag_rules: Optional[MonitoringTagRulesProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.MonitoredSubscriptionProperties(ProxyResource): + id: str + name: str + properties: Optional[SubscriptionList] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[SubscriptionList] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.MonitoringStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DISABLED = "Disabled" + ENABLED = "Enabled" + + + class azure.mgmt.elastic.models.MonitoringTagRules(ProxyResource): + id: str + name: str + properties: Optional[MonitoringTagRulesProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[MonitoringTagRulesProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.MonitoringTagRulesProperties(_Model): + log_rules: Optional[LogRules] + provisioning_state: Optional[Union[str, ProvisioningState]] + + @overload + def __init__( + self, + *, + log_rules: Optional[LogRules] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.OpenAIIntegrationProperties(_Model): + key: Optional[str] + last_refresh_at: Optional[datetime] + open_ai_connector_id: Optional[str] + open_ai_resource_endpoint: Optional[str] + open_ai_resource_id: Optional[str] + + @overload + def __init__( + self, + *, + key: Optional[str] = ..., + open_ai_connector_id: Optional[str] = ..., + open_ai_resource_endpoint: Optional[str] = ..., + open_ai_resource_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.OpenAIIntegrationRPModel(ProxyResource): + id: str + name: str + properties: Optional[OpenAIIntegrationProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[OpenAIIntegrationProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.OpenAIIntegrationStatusResponse(_Model): + properties: Optional[OpenAIIntegrationStatusResponseProperties] + + @overload + def __init__( + self, + *, + properties: Optional[OpenAIIntegrationStatusResponseProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.OpenAIIntegrationStatusResponseProperties(_Model): + status: Optional[str] + + @overload + def __init__( + self, + *, + status: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.Operation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACTIVE = "Active" + ADD_BEGIN = "AddBegin" + ADD_COMPLETE = "AddComplete" + DELETE_BEGIN = "DeleteBegin" + DELETE_COMPLETE = "DeleteComplete" + + + class azure.mgmt.elastic.models.OperationDisplay(_Model): + description: Optional[str] + operation: Optional[str] + provider: Optional[str] + resource: Optional[str] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + operation: Optional[str] = ..., + provider: Optional[str] = ..., + resource: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.OperationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ADD = "Add" + DELETE = "Delete" + + + class azure.mgmt.elastic.models.OperationResult(_Model): + display: Optional[OperationDisplay] + is_data_action: Optional[bool] + name: Optional[str] + origin: Optional[str] + + @overload + def __init__( + self, + *, + display: Optional[OperationDisplay] = ..., + is_data_action: Optional[bool] = ..., + name: Optional[str] = ..., + origin: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.PartnerBillingEntity(_Model): + id: Optional[str] + name: Optional[str] + partner_entity_uri: Optional[str] + + @overload + def __init__( + self, + *, + id: Optional[str] = ..., + name: Optional[str] = ..., + partner_entity_uri: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.PlanDetails(_Model): + offer_id: Optional[str] + plan_id: Optional[str] + plan_name: Optional[str] + publisher_id: Optional[str] + term_id: Optional[str] + + @overload + def __init__( + self, + *, + offer_id: Optional[str] = ..., + plan_id: Optional[str] = ..., + plan_name: Optional[str] = ..., + publisher_id: Optional[str] = ..., + term_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ProjectDetails(_Model): + configuration_type: Optional[Union[str, ConfigurationType]] + project_type: Optional[Union[str, ProjectType]] + + @overload + def __init__( + self, + *, + configuration_type: Optional[Union[str, ConfigurationType]] = ..., + project_type: Optional[Union[str, ProjectType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ProjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ELASTICSEARCH = "Elasticsearch" + NOT_APPLICABLE = "NotApplicable" + OBSERVABILITY = "Observability" + SECURITY = "Security" + + + class azure.mgmt.elastic.models.ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACCEPTED = "Accepted" + CANCELED = "Canceled" + CREATING = "Creating" + DELETED = "Deleted" + DELETING = "Deleting" + FAILED = "Failed" + NOT_SPECIFIED = "NotSpecified" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + + class azure.mgmt.elastic.models.ProxyResource(Resource): + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.elastic.models.Resource(_Model): + id: Optional[str] + name: Optional[str] + system_data: Optional[SystemData] + type: Optional[str] + + + class azure.mgmt.elastic.models.ResourceProviderDefaultErrorResponse(_Model): + error: Optional[ErrorResponseBody] + + + class azure.mgmt.elastic.models.ResourceSku(_Model): + name: str + + @overload + def __init__( + self, + *, + name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.ResubscribeProperties(_Model): + organization_id: Optional[str] + plan_id: Optional[str] + resource_group: Optional[str] + subscription_id: Optional[str] + term: Optional[str] + + @overload + def __init__( + self, + *, + organization_id: Optional[str] = ..., + plan_id: Optional[str] = ..., + resource_group: Optional[str] = ..., + subscription_id: Optional[str] = ..., + term: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.SendingLogs(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FALSE = "False" + TRUE = "True" + + + class azure.mgmt.elastic.models.Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACTIVE = "Active" + DELETING = "Deleting" + FAILED = "Failed" + IN_PROGRESS = "InProgress" + + + class azure.mgmt.elastic.models.SubscriptionList(_Model): + monitored_subscription_list: Optional[list[MonitoredSubscription]] + operation: Optional[Union[str, Operation]] + provisioning_state: Optional[Union[str, ProvisioningState]] + + @overload + def __init__( + self, + *, + monitored_subscription_list: Optional[list[MonitoredSubscription]] = ..., + operation: Optional[Union[str, Operation]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.SystemData(_Model): + created_at: Optional[datetime] + created_by: Optional[str] + created_by_type: Optional[Union[str, CreatedByType]] + last_modified_at: Optional[datetime] + last_modified_by: Optional[str] + last_modified_by_type: Optional[Union[str, CreatedByType]] + + @overload + def __init__( + self, + *, + created_at: Optional[datetime] = ..., + created_by: Optional[str] = ..., + created_by_type: Optional[Union[str, CreatedByType]] = ..., + last_modified_at: Optional[datetime] = ..., + last_modified_by: Optional[str] = ..., + last_modified_by_type: Optional[Union[str, CreatedByType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.TagAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + EXCLUDE = "Exclude" + INCLUDE = "Include" + + + class azure.mgmt.elastic.models.TrackedResource(Resource): + id: str + location: str + name: str + system_data: SystemData + tags: Optional[dict[str, str]] + type: str + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AZURE_PRIVATE_ENDPOINT = "azure_private_endpoint" + IP = "ip" + + + class azure.mgmt.elastic.models.UpgradableVersionsList(_Model): + current_version: Optional[str] + upgradable_versions: Optional[list[str]] + + @overload + def __init__( + self, + *, + current_version: Optional[str] = ..., + upgradable_versions: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.UserApiKeyResponse(_Model): + properties: Optional[UserApiKeyResponseProperties] + + @overload + def __init__( + self, + *, + properties: Optional[UserApiKeyResponseProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.UserApiKeyResponseProperties(_Model): + api_key: Optional[str] + + @overload + def __init__( + self, + *, + api_key: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.UserEmailId(_Model): + email_id: Optional[str] + + @overload + def __init__( + self, + *, + email_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.UserInfo(_Model): + company_info: Optional[CompanyInfo] + company_name: Optional[str] + email_address: Optional[str] + first_name: Optional[str] + last_name: Optional[str] + + @overload + def __init__( + self, + *, + company_info: Optional[CompanyInfo] = ..., + company_name: Optional[str] = ..., + email_address: Optional[str] = ..., + first_name: Optional[str] = ..., + last_name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.VMCollectionUpdate(_Model): + operation_name: Optional[Union[str, OperationName]] + vm_resource_id: Optional[str] + + @overload + def __init__( + self, + *, + operation_name: Optional[Union[str, OperationName]] = ..., + vm_resource_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.VMIngestionDetailsResponse(_Model): + cloud_id: Optional[str] + ingestion_key: Optional[str] + + @overload + def __init__( + self, + *, + cloud_id: Optional[str] = ..., + ingestion_key: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.elastic.models.VMResources(_Model): + vm_resource_id: Optional[str] + + @overload + def __init__( + self, + *, + vm_resource_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + +namespace azure.mgmt.elastic.operations + + class azure.mgmt.elastic.operations.AllTrafficFiltersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ElasticTrafficFilterResponse: ... + + + class azure.mgmt.elastic.operations.AssociateTrafficFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def begin_associate( + self, + resource_group_name: str, + monitor_name: str, + *, + ruleset_id: Optional[str] = ..., + **kwargs: Any + ) -> LROPoller[None]: ... + + + class azure.mgmt.elastic.operations.BillingInfoOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> BillingInfoResponse: ... + + + class azure.mgmt.elastic.operations.ConnectedPartnerResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ItemPaged[ConnectedPartnerResourcesListFormat]: ... + + + class azure.mgmt.elastic.operations.DeploymentInfoOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> DeploymentInfoResponse: ... + + + class azure.mgmt.elastic.operations.DetachAndDeleteTrafficFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def delete( + self, + resource_group_name: str, + monitor_name: str, + *, + ruleset_id: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.elastic.operations.DetachTrafficFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + *, + ruleset_id: Optional[str] = ..., + **kwargs: Any + ) -> LROPoller[None]: ... + + + class azure.mgmt.elastic.operations.ElasticVersionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + *, + region: str, + **kwargs: Any + ) -> ItemPaged[ElasticVersionListFormat]: ... + + + class azure.mgmt.elastic.operations.ExternalUserOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ExternalUserInfo] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ExternalUserCreationResponse: ... + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ExternalUserInfo] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ExternalUserCreationResponse: ... + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ExternalUserCreationResponse: ... + + + class azure.mgmt.elastic.operations.MonitorOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorUpgrade] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorUpgrade] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + + class azure.mgmt.elastic.operations.MonitoredResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ItemPaged[MonitoredResource]: ... + + + class azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[MonitoredSubscriptionProperties]: ... + + @overload + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[MonitoredSubscriptionProperties]: ... + + @overload + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[MonitoredSubscriptionProperties]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[MonitoredSubscriptionProperties]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[MonitoredSubscriptionProperties]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[MonitoredSubscriptionProperties]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + **kwargs: Any + ) -> MonitoredSubscriptionProperties: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ItemPaged[MonitoredSubscriptionProperties]: ... + + + class azure.mgmt.elastic.operations.MonitorsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ElasticMonitorResource]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ElasticMonitorResource]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ElasticMonitorResource]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorResourceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ElasticMonitorResource]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ElasticMonitorResourceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ElasticMonitorResource]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ElasticMonitorResource]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ElasticMonitorResource: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[ElasticMonitorResource]: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> ItemPaged[ElasticMonitorResource]: ... + + + class azure.mgmt.elastic.operations.OpenAIOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> OpenAIIntegrationRPModel: ... + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> OpenAIIntegrationRPModel: ... + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> OpenAIIntegrationRPModel: ... + + @distributed_trace + def delete( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + **kwargs: Any + ) -> OpenAIIntegrationRPModel: ... + + @distributed_trace + def get_status( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + **kwargs: Any + ) -> OpenAIIntegrationStatusResponse: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ItemPaged[OpenAIIntegrationRPModel]: ... + + + class azure.mgmt.elastic.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[OperationResult]: ... + + + class azure.mgmt.elastic.operations.OrganizationsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ResubscribeProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ElasticMonitorResource]: ... + + @overload + def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ResubscribeProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ElasticMonitorResource]: ... + + @overload + def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ElasticMonitorResource]: ... + + @overload + def get_api_key( + self, + body: Optional[UserEmailId] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> UserApiKeyResponse: ... + + @overload + def get_api_key( + self, + body: Optional[UserEmailId] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> UserApiKeyResponse: ... + + @overload + def get_api_key( + self, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> UserApiKeyResponse: ... + + @distributed_trace + def get_elastic_to_azure_subscription_mapping(self, **kwargs: Any) -> ElasticOrganizationToAzureSubscriptionMappingResponse: ... + + + class azure.mgmt.elastic.operations.TagRulesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[MonitoringTagRules] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MonitoringTagRules: ... + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[MonitoringTagRules] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MonitoringTagRules: ... + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MonitoringTagRules: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> MonitoringTagRules: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ItemPaged[MonitoringTagRules]: ... + + + class azure.mgmt.elastic.operations.TrafficFiltersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def delete( + self, + resource_group_name: str, + monitor_name: str, + *, + ruleset_id: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.elastic.operations.UpgradableVersionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def details( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> UpgradableVersionsList: ... + + + class azure.mgmt.elastic.operations.VMCollectionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[VMCollectionUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[VMCollectionUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.elastic.operations.VMHostOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ItemPaged[VMResources]: ... + + + class azure.mgmt.elastic.operations.VMIngestionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def details( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> VMIngestionDetailsResponse: ... + + + class azure.mgmt.elastic.operations.createAndAssociateIPFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + ips: Optional[str] = ..., + name: Optional[str] = ..., + **kwargs: Any + ) -> LROPoller[None]: ... + + + class azure.mgmt.elastic.operations.createAndAssociatePLFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + name: Optional[str] = ..., + private_endpoint_guid: Optional[str] = ..., + private_endpoint_name: Optional[str] = ..., + **kwargs: Any + ) -> LROPoller[None]: ... + + + class azure.mgmt.elastic.operations.listAssociatedTrafficFiltersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ElasticTrafficFilterResponse: ... + + +namespace azure.mgmt.elastic.types + + class azure.mgmt.elastic.types.BillingInfoResponse(TypedDict, total=False): + key "marketplaceSaasInfo": ForwardRef('MarketplaceSaaSInfo', module='types') + key "partnerBillingEntity": ForwardRef('PartnerBillingEntity', module='types') + marketplace_saas_info: MarketplaceSaaSInfo + partner_billing_entity: PartnerBillingEntity + + + class azure.mgmt.elastic.types.CompanyInfo(TypedDict, total=False): + key "business": str + key "country": str + key "domain": str + key "employeesNumber": str + key "state": str + business: str + country: str + domain: str + employees_number: str + state: str + + + class azure.mgmt.elastic.types.ConnectedPartnerResourceProperties(TypedDict, total=False): + key "azureResourceId": str + key "location": str + key "partnerDeploymentName": str + key "partnerDeploymentUri": str + key "type": str + azure_resource_id: str + location: str + partner_deployment_name: str + partner_deployment_uri: str + type: str + + + class azure.mgmt.elastic.types.ConnectedPartnerResourcesListFormat(TypedDict, total=False): + key "properties": ForwardRef('ConnectedPartnerResourceProperties', module='types') + properties: ConnectedPartnerResourceProperties + + + class azure.mgmt.elastic.types.DeploymentInfoResponse(TypedDict, total=False): + key "configurationType": str + key "deploymentUrl": str + key "diskCapacity": str + key "elasticsearchEndPoint": str + key "marketplaceSaasInfo": ForwardRef('MarketplaceSaaSInfo', module='types') + key "memoryCapacity": str + key "projectType": str + key "status": Union[str, ElasticDeploymentStatus] + key "version": str + configuration_type: str + deployment_url: str + disk_capacity: str + elasticsearch_end_point: str + marketplace_saas_info: MarketplaceSaaSInfo + memory_capacity: str + project_type: str + status: Union[str, ElasticDeploymentStatus] + version: str + + + class azure.mgmt.elastic.types.ElasticCloudDeployment(TypedDict, total=False): + key "azureSubscriptionId": str + key "deploymentId": str + key "elasticsearchRegion": str + key "elasticsearchServiceUrl": str + key "kibanaServiceUrl": str + key "kibanaSsoUrl": str + key "name": str + azure_subscription_id: str + deployment_id: str + elasticsearch_region: str + elasticsearch_service_url: str + kibana_service_url: str + kibana_sso_url: str + name: str + + + class azure.mgmt.elastic.types.ElasticCloudUser(TypedDict, total=False): + key "elasticCloudSsoDefaultUrl": str + key "emailAddress": str + key "id": str + elastic_cloud_sso_default_url: str + email_address: str + id: str + + + class azure.mgmt.elastic.types.ElasticMonitorResource(TrackedResource): + key "id": str + key "identity": ForwardRef('IdentityProperties', module='types') + key "kind": str + key "location": Required[str] + key "name": str + key "properties": ForwardRef('MonitorProperties', module='types') + key "sku": ForwardRef('ResourceSku', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + identity: IdentityProperties + kind: str + location: str + name: str + properties: MonitorProperties + sku: ResourceSku + system_data: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.elastic.types.ElasticMonitorResourceUpdateParameters(TypedDict, total=False): + tags: dict[str, str] + + + class azure.mgmt.elastic.types.ElasticMonitorUpgrade(TypedDict, total=False): + key "version": str + version: str + + + class azure.mgmt.elastic.types.ElasticOrganizationToAzureSubscriptionMappingResponse(TypedDict, total=False): + key "properties": ForwardRef('ElasticOrganizationToAzureSubscriptionMappingResponseProperties', module='types') + properties: ElasticOrganizationToAzureSubscriptionMappingResponseProperties + + + class azure.mgmt.elastic.types.ElasticOrganizationToAzureSubscriptionMappingResponseProperties(TypedDict, total=False): + key "billedAzureSubscriptionId": str + key "elasticOrganizationId": str + key "elasticOrganizationName": str + key "marketplaceSaasInfo": ForwardRef('MarketplaceSaaSInfo', module='types') + billed_azure_subscription_id: str + elastic_organization_id: str + elastic_organization_name: str + marketplace_saas_info: MarketplaceSaaSInfo + + + class azure.mgmt.elastic.types.ElasticProperties(TypedDict, total=False): + key "elasticCloudDeployment": ForwardRef('ElasticCloudDeployment', module='types') + key "elasticCloudUser": ForwardRef('ElasticCloudUser', module='types') + elastic_cloud_deployment: ElasticCloudDeployment + elastic_cloud_user: ElasticCloudUser + + + class azure.mgmt.elastic.types.ElasticTrafficFilter(TypedDict, total=False): + key "description": str + key "id": str + key "includeByDefault": bool + key "name": str + key "region": str + key "type": Union[str, Type] + description: str + id: str + include_by_default: bool + name: str + region: str + rules: list[ElasticTrafficFilterRule] + type: Union[str, Type] + + + class azure.mgmt.elastic.types.ElasticTrafficFilterResponse(TypedDict, total=False): + rulesets: list[ElasticTrafficFilter] + + + class azure.mgmt.elastic.types.ElasticTrafficFilterRule(TypedDict, total=False): + key "azureEndpointGuid": str + key "azureEndpointName": str + key "description": str + key "id": str + key "source": str + azure_endpoint_guid: str + azure_endpoint_name: str + description: str + id: str + source: str + + + class azure.mgmt.elastic.types.ElasticVersionListFormat(TypedDict, total=False): + key "properties": ForwardRef('ElasticVersionListProperties', module='types') + properties: ElasticVersionListProperties + + + class azure.mgmt.elastic.types.ElasticVersionListProperties(TypedDict, total=False): + key "version": str + version: str + + + class azure.mgmt.elastic.types.ErrorAdditionalInfo(TypedDict, total=False): + key "info": Any + key "type": str + info: Any + type: str + + + class azure.mgmt.elastic.types.ErrorDetail(TypedDict, total=False): + key "code": str + key "message": str + key "target": str + additionalInfo: list[ErrorAdditionalInfo] + additional_info: list[ErrorAdditionalInfo] + code: str + details: list[ErrorDetail] + message: str + target: str + + + class azure.mgmt.elastic.types.ErrorResponse(TypedDict, total=False): + key "error": ForwardRef('ErrorDetail', module='types') + error: ErrorDetail + + + class azure.mgmt.elastic.types.ErrorResponseBody(TypedDict, total=False): + key "code": str + key "message": str + key "target": str + code: str + details: list[ErrorResponseBody] + message: str + target: str + + + class azure.mgmt.elastic.types.ExternalUserCreationResponse(TypedDict, total=False): + key "created": bool + created: bool + + + class azure.mgmt.elastic.types.ExternalUserInfo(TypedDict, total=False): + key "emailId": str + key "fullName": str + key "password": str + key "userName": str + email_id: str + full_name: str + password: str + roles: list[str] + user_name: str + + + class azure.mgmt.elastic.types.FilteringTag(TypedDict, total=False): + key "action": Union[str, TagAction] + key "name": str + key "value": str + action: Union[str, TagAction] + name: str + value: str + + + class azure.mgmt.elastic.types.IdentityProperties(TypedDict, total=False): + key "principalId": str + key "tenantId": str + key "type": Union[str, ManagedIdentityTypes] + principal_id: str + tenant_id: str + type: Union[str, ManagedIdentityTypes] + + + class azure.mgmt.elastic.types.LogRules(TypedDict, total=False): + key "sendAadLogs": bool + key "sendActivityLogs": bool + key "sendSubscriptionLogs": bool + filteringTags: list[FilteringTag] + filtering_tags: list[FilteringTag] + send_aad_logs: bool + send_activity_logs: bool + send_subscription_logs: bool + + + class azure.mgmt.elastic.types.MarketplaceSaaSInfo(TypedDict, total=False): + key "billedAzureSubscriptionId": str + key "marketplaceName": str + key "marketplaceResourceId": str + key "marketplaceStatus": str + key "marketplaceSubscription": ForwardRef('MarketplaceSaaSInfoMarketplaceSubscription', module='types') + key "subscribed": bool + billed_azure_subscription_id: str + marketplace_name: str + marketplace_resource_id: str + marketplace_status: str + marketplace_subscription: MarketplaceSaaSInfoMarketplaceSubscription + subscribed: bool + + + class azure.mgmt.elastic.types.MarketplaceSaaSInfoMarketplaceSubscription(TypedDict, total=False): + key "id": str + key "offerId": str + key "publisherId": str + id: str + offer_id: str + publisher_id: str + + + class azure.mgmt.elastic.types.MonitorProperties(TypedDict, total=False): + key "elasticProperties": ForwardRef('ElasticProperties', module='types') + key "generateApiKey": bool + key "hostingType": Union[str, HostingType] + key "liftrResourceCategory": Union[str, LiftrResourceCategories] + key "liftrResourcePreference": int + key "monitoringStatus": Union[str, MonitoringStatus] + key "planDetails": ForwardRef('PlanDetails', module='types') + key "projectDetails": ForwardRef('ProjectDetails', module='types') + key "provisioningState": Union[str, ProvisioningState] + key "saaSAzureSubscriptionStatus": str + key "sourceCampaignId": str + key "sourceCampaignName": str + key "subscriptionState": str + key "userInfo": ForwardRef('UserInfo', module='types') + key "version": str + elastic_properties: ElasticProperties + generate_api_key: bool + hosting_type: Union[str, HostingType] + liftr_resource_category: Union[str, LiftrResourceCategories] + liftr_resource_preference: int + monitoring_status: Union[str, MonitoringStatus] + plan_details: PlanDetails + project_details: ProjectDetails + provisioning_state: Union[str, ProvisioningState] + saa_s_azure_subscription_status: str + source_campaign_id: str + source_campaign_name: str + subscription_state: str + user_info: UserInfo + version: str + + + class azure.mgmt.elastic.types.MonitoredResource(TypedDict, total=False): + key "id": str + key "reasonForLogsStatus": str + key "sendingLogs": Union[str, SendingLogs] + id: str + reason_for_logs_status: str + sending_logs: Union[str, SendingLogs] + + + class azure.mgmt.elastic.types.MonitoredSubscription(TypedDict, total=False): + key "error": str + key "status": Union[str, Status] + key "subscriptionId": Required[str] + key "tagRules": ForwardRef('MonitoringTagRulesProperties', module='types') + error: str + status: Union[str, Status] + subscription_id: str + tag_rules: MonitoringTagRulesProperties + + + class azure.mgmt.elastic.types.MonitoredSubscriptionProperties(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('SubscriptionList', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: SubscriptionList + system_data: SystemData + type: str + + + class azure.mgmt.elastic.types.MonitoringTagRules(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('MonitoringTagRulesProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: MonitoringTagRulesProperties + system_data: SystemData + type: str + + + class azure.mgmt.elastic.types.MonitoringTagRulesProperties(TypedDict, total=False): + key "logRules": ForwardRef('LogRules', module='types') + key "provisioningState": Union[str, ProvisioningState] + log_rules: LogRules + provisioning_state: Union[str, ProvisioningState] + + + class azure.mgmt.elastic.types.OpenAIIntegrationProperties(TypedDict, total=False): + key "key": str + key "lastRefreshAt": str + key "openAIConnectorId": str + key "openAIResourceEndpoint": str + key "openAIResourceId": str + key: str + last_refresh_at: str + open_ai_connector_id: str + open_ai_resource_endpoint: str + open_ai_resource_id: str + + + class azure.mgmt.elastic.types.OpenAIIntegrationRPModel(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('OpenAIIntegrationProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: OpenAIIntegrationProperties + system_data: SystemData + type: str + + + class azure.mgmt.elastic.types.OpenAIIntegrationStatusResponse(TypedDict, total=False): + key "properties": ForwardRef('OpenAIIntegrationStatusResponseProperties', module='types') + properties: OpenAIIntegrationStatusResponseProperties + + + class azure.mgmt.elastic.types.OpenAIIntegrationStatusResponseProperties(TypedDict, total=False): + key "status": str + status: str + + + class azure.mgmt.elastic.types.OperationDisplay(TypedDict, total=False): + key "description": str + key "operation": str + key "provider": str + key "resource": str + description: str + operation: str + provider: str + resource: str + + + class azure.mgmt.elastic.types.OperationResult(TypedDict, total=False): + key "display": ForwardRef('OperationDisplay', module='types') + key "isDataAction": bool + key "name": str + key "origin": str + display: OperationDisplay + is_data_action: bool + name: str + origin: str + + + class azure.mgmt.elastic.types.PartnerBillingEntity(TypedDict, total=False): + key "id": str + key "name": str + key "partnerEntityUri": str + id: str + name: str + partner_entity_uri: str + + + class azure.mgmt.elastic.types.PlanDetails(TypedDict, total=False): + key "offerID": str + key "planID": str + key "planName": str + key "publisherID": str + key "termID": str + offer_id: str + plan_id: str + plan_name: str + publisher_id: str + term_id: str + + + class azure.mgmt.elastic.types.ProjectDetails(TypedDict, total=False): + key "configurationType": Union[str, ConfigurationType] + key "projectType": Union[str, ProjectType] + configuration_type: Union[str, ConfigurationType] + project_type: Union[str, ProjectType] + + + class azure.mgmt.elastic.types.ProxyResource(Resource): + key "id": str + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.elastic.types.Resource(TypedDict, total=False): + key "id": str + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.elastic.types.ResourceProviderDefaultErrorResponse(TypedDict, total=False): + key "error": ForwardRef('ErrorResponseBody', module='types') + error: ErrorResponseBody + + + class azure.mgmt.elastic.types.ResourceSku(TypedDict, total=False): + key "name": Required[str] + name: str + + + class azure.mgmt.elastic.types.ResubscribeProperties(TypedDict, total=False): + key "organizationId": str + key "planId": str + key "resourceGroup": str + key "subscriptionId": str + key "term": str + organization_id: str + plan_id: str + resource_group: str + subscription_id: str + term: str + + + class azure.mgmt.elastic.types.SubscriptionList(TypedDict, total=False): + key "operation": Union[str, Operation] + key "provisioningState": Union[str, ProvisioningState] + monitoredSubscriptionList: list[MonitoredSubscription] + monitored_subscription_list: list[MonitoredSubscription] + operation: Union[str, Operation] + provisioning_state: Union[str, ProvisioningState] + + + class azure.mgmt.elastic.types.SystemData(TypedDict, total=False): + key "createdAt": str + key "createdBy": str + key "createdByType": Union[str, CreatedByType] + key "lastModifiedAt": str + key "lastModifiedBy": str + key "lastModifiedByType": Union[str, CreatedByType] + created_at: str + created_by: str + created_by_type: Union[str, CreatedByType] + last_modified_at: str + last_modified_by: str + last_modified_by_type: Union[str, CreatedByType] + + + class azure.mgmt.elastic.types.TrackedResource(Resource): + key "id": str + key "location": Required[str] + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + location: str + name: str + system_data: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.elastic.types.UpgradableVersionsList(TypedDict, total=False): + key "currentVersion": str + current_version: str + upgradableVersions: list[str] + upgradable_versions: list[str] + + + class azure.mgmt.elastic.types.UserApiKeyResponse(TypedDict, total=False): + key "properties": ForwardRef('UserApiKeyResponseProperties', module='types') + properties: UserApiKeyResponseProperties + + + class azure.mgmt.elastic.types.UserApiKeyResponseProperties(TypedDict, total=False): + key "apiKey": str + api_key: str + + + class azure.mgmt.elastic.types.UserEmailId(TypedDict, total=False): + key "emailId": str + email_id: str + + + class azure.mgmt.elastic.types.UserInfo(TypedDict, total=False): + key "companyInfo": ForwardRef('CompanyInfo', module='types') + key "companyName": str + key "emailAddress": str + key "firstName": str + key "lastName": str + company_info: CompanyInfo + company_name: str + email_address: str + first_name: str + last_name: str + + + class azure.mgmt.elastic.types.VMCollectionUpdate(TypedDict, total=False): + key "operationName": Union[str, OperationName] + key "vmResourceId": str + operation_name: Union[str, OperationName] + vm_resource_id: str + + + class azure.mgmt.elastic.types.VMIngestionDetailsResponse(TypedDict, total=False): + key "cloudId": str + key "ingestionKey": str + cloud_id: str + ingestion_key: str + + + class azure.mgmt.elastic.types.VMResources(TypedDict, total=False): + key "vmResourceId": str + vm_resource_id: str + + +``` \ No newline at end of file diff --git a/sdk/elastic/azure-mgmt-elastic/api.metadata.yml b/sdk/elastic/azure-mgmt-elastic/api.metadata.yml new file mode 100644 index 000000000000..0b1b05372698 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/api.metadata.yml @@ -0,0 +1,3 @@ +apiMdSha256: aae05c0c77675eb2f5675c5f45bb4cfe2e77e325289753faafd540910d95c378 +parserVersion: 0.3.28 +pythonVersion: 3.13.13 diff --git a/sdk/elastic/azure-mgmt-elastic/apiview-properties.json b/sdk/elastic/azure-mgmt-elastic/apiview-properties.json index 5f7aca6c06e3..618e7db142da 100644 --- a/sdk/elastic/azure-mgmt-elastic/apiview-properties.json +++ b/sdk/elastic/azure-mgmt-elastic/apiview-properties.json @@ -1,172 +1,167 @@ { - "CrossLanguagePackageId": null, + "CrossLanguagePackageId": "Microsoft.Elastic", "CrossLanguageDefinitionId": { - "azure.mgmt.elastic.models.BillingInfoResponse": null, - "azure.mgmt.elastic.models.CompanyInfo": null, - "azure.mgmt.elastic.models.ConnectedPartnerResourceProperties": null, - "azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat": null, - "azure.mgmt.elastic.models.ConnectedPartnerResourcesListResponse": null, - "azure.mgmt.elastic.models.DeploymentInfoResponse": null, - "azure.mgmt.elastic.models.ElasticCloudDeployment": null, - "azure.mgmt.elastic.models.ElasticCloudUser": null, - "azure.mgmt.elastic.models.ElasticMonitorResource": null, - "azure.mgmt.elastic.models.ElasticMonitorResourceListResponse": null, - "azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters": null, - "azure.mgmt.elastic.models.ElasticMonitorUpgrade": null, - "azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse": null, - "azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties": null, - "azure.mgmt.elastic.models.ElasticProperties": null, - "azure.mgmt.elastic.models.ElasticTrafficFilter": null, - "azure.mgmt.elastic.models.ElasticTrafficFilterResponse": null, - "azure.mgmt.elastic.models.ElasticTrafficFilterRule": null, - "azure.mgmt.elastic.models.ElasticVersionListFormat": null, - "azure.mgmt.elastic.models.ElasticVersionListProperties": null, - "azure.mgmt.elastic.models.ElasticVersionsListResponse": null, - "azure.mgmt.elastic.models.ErrorAdditionalInfo": null, - "azure.mgmt.elastic.models.ErrorDetail": null, - "azure.mgmt.elastic.models.ErrorResponse": null, - "azure.mgmt.elastic.models.ErrorResponseBody": null, - "azure.mgmt.elastic.models.ExternalUserCreationResponse": null, - "azure.mgmt.elastic.models.ExternalUserInfo": null, - "azure.mgmt.elastic.models.FilteringTag": null, - "azure.mgmt.elastic.models.IdentityProperties": null, - "azure.mgmt.elastic.models.LogRules": null, - "azure.mgmt.elastic.models.MarketplaceSaaSInfo": null, - "azure.mgmt.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription": null, - "azure.mgmt.elastic.models.MonitoredResource": null, - "azure.mgmt.elastic.models.MonitoredResourceListResponse": null, - "azure.mgmt.elastic.models.MonitoredSubscription": null, - "azure.mgmt.elastic.models.MonitoredSubscriptionProperties": null, - "azure.mgmt.elastic.models.MonitoredSubscriptionPropertiesList": null, - "azure.mgmt.elastic.models.MonitoringTagRules": null, - "azure.mgmt.elastic.models.MonitoringTagRulesListResponse": null, - "azure.mgmt.elastic.models.MonitoringTagRulesProperties": null, - "azure.mgmt.elastic.models.MonitorProperties": null, - "azure.mgmt.elastic.models.OpenAIIntegrationProperties": null, - "azure.mgmt.elastic.models.OpenAIIntegrationRPModel": null, - "azure.mgmt.elastic.models.OpenAIIntegrationRPModelListResponse": null, - "azure.mgmt.elastic.models.OpenAIIntegrationStatusResponse": null, - "azure.mgmt.elastic.models.OpenAIIntegrationStatusResponseProperties": null, - "azure.mgmt.elastic.models.OperationDisplay": null, - "azure.mgmt.elastic.models.OperationListResult": null, - "azure.mgmt.elastic.models.OperationResult": null, - "azure.mgmt.elastic.models.PartnerBillingEntity": null, - "azure.mgmt.elastic.models.PlanDetails": null, - "azure.mgmt.elastic.models.ProjectDetails": null, - "azure.mgmt.elastic.models.ResourceProviderDefaultErrorResponse": null, - "azure.mgmt.elastic.models.ResourceSku": null, - "azure.mgmt.elastic.models.ResubscribeProperties": null, - "azure.mgmt.elastic.models.SubscriptionList": null, - "azure.mgmt.elastic.models.SystemData": null, - "azure.mgmt.elastic.models.UpgradableVersionsList": null, - "azure.mgmt.elastic.models.UserApiKeyResponse": null, - "azure.mgmt.elastic.models.UserApiKeyResponseProperties": null, - "azure.mgmt.elastic.models.UserEmailId": null, - "azure.mgmt.elastic.models.UserInfo": null, - "azure.mgmt.elastic.models.VMCollectionUpdate": null, - "azure.mgmt.elastic.models.VMHostListResponse": null, - "azure.mgmt.elastic.models.VMIngestionDetailsResponse": null, - "azure.mgmt.elastic.models.VMResources": null, - "azure.mgmt.elastic.models.ProvisioningState": null, - "azure.mgmt.elastic.models.MonitoringStatus": null, - "azure.mgmt.elastic.models.LiftrResourceCategories": null, - "azure.mgmt.elastic.models.HostingType": null, - "azure.mgmt.elastic.models.ProjectType": null, - "azure.mgmt.elastic.models.ConfigurationType": null, - "azure.mgmt.elastic.models.ManagedIdentityTypes": null, - "azure.mgmt.elastic.models.CreatedByType": null, - "azure.mgmt.elastic.models.TagAction": null, - "azure.mgmt.elastic.models.Status": null, - "azure.mgmt.elastic.models.Operation": null, - "azure.mgmt.elastic.models.SendingLogs": null, - "azure.mgmt.elastic.models.Type": null, - "azure.mgmt.elastic.models.ElasticDeploymentStatus": null, - "azure.mgmt.elastic.models.OperationName": null, - "azure.mgmt.elastic.operations.Operations.list": null, - "azure.mgmt.elastic.aio.operations.Operations.list": null, - "azure.mgmt.elastic.operations.MonitorsOperations.list": null, - "azure.mgmt.elastic.aio.operations.MonitorsOperations.list": null, - "azure.mgmt.elastic.operations.MonitorsOperations.list_by_resource_group": null, - "azure.mgmt.elastic.aio.operations.MonitorsOperations.list_by_resource_group": null, - "azure.mgmt.elastic.operations.MonitorsOperations.get": null, - "azure.mgmt.elastic.aio.operations.MonitorsOperations.get": null, - "azure.mgmt.elastic.operations.MonitorsOperations.begin_create": null, - "azure.mgmt.elastic.aio.operations.MonitorsOperations.begin_create": null, - "azure.mgmt.elastic.operations.MonitorsOperations.begin_update": null, - "azure.mgmt.elastic.aio.operations.MonitorsOperations.begin_update": null, - "azure.mgmt.elastic.operations.MonitorsOperations.begin_delete": null, - "azure.mgmt.elastic.aio.operations.MonitorsOperations.begin_delete": null, - "azure.mgmt.elastic.operations.ElasticVersionsOperations.list": null, - "azure.mgmt.elastic.aio.operations.ElasticVersionsOperations.list": null, - "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.list": null, - "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.list": null, - "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.get": null, - "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.get": null, - "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.begin_createor_update": null, - "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.begin_createor_update": null, - "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.begin_update": null, - "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.begin_update": null, - "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.begin_delete": null, - "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.begin_delete": null, - "azure.mgmt.elastic.operations.MonitoredResourcesOperations.list": null, - "azure.mgmt.elastic.aio.operations.MonitoredResourcesOperations.list": null, - "azure.mgmt.elastic.operations.DeploymentInfoOperations.list": null, - "azure.mgmt.elastic.aio.operations.DeploymentInfoOperations.list": null, - "azure.mgmt.elastic.operations.ExternalUserOperations.create_or_update": null, - "azure.mgmt.elastic.aio.operations.ExternalUserOperations.create_or_update": null, - "azure.mgmt.elastic.operations.BillingInfoOperations.get": null, - "azure.mgmt.elastic.aio.operations.BillingInfoOperations.get": null, - "azure.mgmt.elastic.operations.ConnectedPartnerResourcesOperations.list": null, - "azure.mgmt.elastic.aio.operations.ConnectedPartnerResourcesOperations.list": null, - "azure.mgmt.elastic.operations.OpenAIOperations.list": null, - "azure.mgmt.elastic.aio.operations.OpenAIOperations.list": null, - "azure.mgmt.elastic.operations.OpenAIOperations.get": null, - "azure.mgmt.elastic.aio.operations.OpenAIOperations.get": null, - "azure.mgmt.elastic.operations.OpenAIOperations.create_or_update": null, - "azure.mgmt.elastic.aio.operations.OpenAIOperations.create_or_update": null, - "azure.mgmt.elastic.operations.OpenAIOperations.delete": null, - "azure.mgmt.elastic.aio.operations.OpenAIOperations.delete": null, - "azure.mgmt.elastic.operations.OpenAIOperations.get_status": null, - "azure.mgmt.elastic.aio.operations.OpenAIOperations.get_status": null, - "azure.mgmt.elastic.operations.TagRulesOperations.list": null, - "azure.mgmt.elastic.aio.operations.TagRulesOperations.list": null, - "azure.mgmt.elastic.operations.TagRulesOperations.create_or_update": null, - "azure.mgmt.elastic.aio.operations.TagRulesOperations.create_or_update": null, - "azure.mgmt.elastic.operations.TagRulesOperations.get": null, - "azure.mgmt.elastic.aio.operations.TagRulesOperations.get": null, - "azure.mgmt.elastic.operations.TagRulesOperations.begin_delete": null, - "azure.mgmt.elastic.aio.operations.TagRulesOperations.begin_delete": null, - "azure.mgmt.elastic.operations.VMHostOperations.list": null, - "azure.mgmt.elastic.aio.operations.VMHostOperations.list": null, - "azure.mgmt.elastic.operations.VMIngestionOperations.details": null, - "azure.mgmt.elastic.aio.operations.VMIngestionOperations.details": null, - "azure.mgmt.elastic.operations.VMCollectionOperations.update": null, - "azure.mgmt.elastic.aio.operations.VMCollectionOperations.update": null, - "azure.mgmt.elastic.operations.UpgradableVersionsOperations.details": null, - "azure.mgmt.elastic.aio.operations.UpgradableVersionsOperations.details": null, - "azure.mgmt.elastic.operations.MonitorOperations.begin_upgrade": null, - "azure.mgmt.elastic.aio.operations.MonitorOperations.begin_upgrade": null, - "azure.mgmt.elastic.operations.AllTrafficFiltersOperations.list": null, - "azure.mgmt.elastic.aio.operations.AllTrafficFiltersOperations.list": null, - "azure.mgmt.elastic.operations.ListAssociatedTrafficFiltersOperations.list": null, - "azure.mgmt.elastic.aio.operations.ListAssociatedTrafficFiltersOperations.list": null, - "azure.mgmt.elastic.operations.CreateAndAssociateIPFilterOperations.begin_create": null, - "azure.mgmt.elastic.aio.operations.CreateAndAssociateIPFilterOperations.begin_create": null, - "azure.mgmt.elastic.operations.CreateAndAssociatePLFilterOperations.begin_create": null, - "azure.mgmt.elastic.aio.operations.CreateAndAssociatePLFilterOperations.begin_create": null, - "azure.mgmt.elastic.operations.AssociateTrafficFilterOperations.begin_associate": null, - "azure.mgmt.elastic.aio.operations.AssociateTrafficFilterOperations.begin_associate": null, - "azure.mgmt.elastic.operations.DetachAndDeleteTrafficFilterOperations.delete": null, - "azure.mgmt.elastic.aio.operations.DetachAndDeleteTrafficFilterOperations.delete": null, - "azure.mgmt.elastic.operations.DetachTrafficFilterOperations.begin_update": null, - "azure.mgmt.elastic.aio.operations.DetachTrafficFilterOperations.begin_update": null, - "azure.mgmt.elastic.operations.TrafficFiltersOperations.delete": null, - "azure.mgmt.elastic.aio.operations.TrafficFiltersOperations.delete": null, - "azure.mgmt.elastic.operations.OrganizationsOperations.get_api_key": null, - "azure.mgmt.elastic.aio.operations.OrganizationsOperations.get_api_key": null, - "azure.mgmt.elastic.operations.OrganizationsOperations.get_elastic_to_azure_subscription_mapping": null, - "azure.mgmt.elastic.aio.operations.OrganizationsOperations.get_elastic_to_azure_subscription_mapping": null, - "azure.mgmt.elastic.operations.OrganizationsOperations.begin_resubscribe": null, - "azure.mgmt.elastic.aio.operations.OrganizationsOperations.begin_resubscribe": null - } + "azure.mgmt.elastic.models.BillingInfoResponse": "Microsoft.Elastic.BillingInfoResponse", + "azure.mgmt.elastic.models.CompanyInfo": "Microsoft.Elastic.CompanyInfo", + "azure.mgmt.elastic.models.ConnectedPartnerResourceProperties": "Microsoft.Elastic.ConnectedPartnerResourceProperties", + "azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat": "Microsoft.Elastic.ConnectedPartnerResourcesListFormat", + "azure.mgmt.elastic.models.DeploymentInfoResponse": "Microsoft.Elastic.DeploymentInfoResponse", + "azure.mgmt.elastic.models.ElasticCloudDeployment": "Microsoft.Elastic.ElasticCloudDeployment", + "azure.mgmt.elastic.models.ElasticCloudUser": "Microsoft.Elastic.ElasticCloudUser", + "azure.mgmt.elastic.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.elastic.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.elastic.models.ElasticMonitorResource": "Microsoft.Elastic.ElasticMonitorResource", + "azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters": "Microsoft.Elastic.ElasticMonitorResourceUpdateParameters", + "azure.mgmt.elastic.models.ElasticMonitorUpgrade": "Microsoft.Elastic.ElasticMonitorUpgrade", + "azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse": "Microsoft.Elastic.ElasticOrganizationToAzureSubscriptionMappingResponse", + "azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties": "Microsoft.Elastic.ElasticOrganizationToAzureSubscriptionMappingResponseProperties", + "azure.mgmt.elastic.models.ElasticProperties": "Microsoft.Elastic.ElasticProperties", + "azure.mgmt.elastic.models.ElasticTrafficFilter": "Microsoft.Elastic.ElasticTrafficFilter", + "azure.mgmt.elastic.models.ElasticTrafficFilterResponse": "Microsoft.Elastic.ElasticTrafficFilterResponse", + "azure.mgmt.elastic.models.ElasticTrafficFilterRule": "Microsoft.Elastic.ElasticTrafficFilterRule", + "azure.mgmt.elastic.models.ElasticVersionListFormat": "Microsoft.Elastic.ElasticVersionListFormat", + "azure.mgmt.elastic.models.ElasticVersionListProperties": "Microsoft.Elastic.ElasticVersionListProperties", + "azure.mgmt.elastic.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.elastic.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.elastic.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.elastic.models.ErrorResponseBody": "Microsoft.Elastic.ErrorResponseBody", + "azure.mgmt.elastic.models.ExternalUserCreationResponse": "Microsoft.Elastic.ExternalUserCreationResponse", + "azure.mgmt.elastic.models.ExternalUserInfo": "Microsoft.Elastic.ExternalUserInfo", + "azure.mgmt.elastic.models.FilteringTag": "Microsoft.Elastic.FilteringTag", + "azure.mgmt.elastic.models.IdentityProperties": "Microsoft.Elastic.IdentityProperties", + "azure.mgmt.elastic.models.LogRules": "Microsoft.Elastic.LogRules", + "azure.mgmt.elastic.models.MarketplaceSaaSInfo": "Microsoft.Elastic.MarketplaceSaaSInfo", + "azure.mgmt.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription": "Microsoft.Elastic.MarketplaceSaaSInfoMarketplaceSubscription", + "azure.mgmt.elastic.models.MonitoredResource": "Microsoft.Elastic.MonitoredResource", + "azure.mgmt.elastic.models.MonitoredSubscription": "Microsoft.Elastic.MonitoredSubscription", + "azure.mgmt.elastic.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.elastic.models.MonitoredSubscriptionProperties": "Microsoft.Elastic.MonitoredSubscriptionProperties", + "azure.mgmt.elastic.models.MonitoringTagRules": "Microsoft.Elastic.MonitoringTagRules", + "azure.mgmt.elastic.models.MonitoringTagRulesProperties": "Microsoft.Elastic.MonitoringTagRulesProperties", + "azure.mgmt.elastic.models.MonitorProperties": "Microsoft.Elastic.MonitorProperties", + "azure.mgmt.elastic.models.OpenAIIntegrationProperties": "Microsoft.Elastic.OpenAIIntegrationProperties", + "azure.mgmt.elastic.models.OpenAIIntegrationRPModel": "Microsoft.Elastic.OpenAIIntegrationRPModel", + "azure.mgmt.elastic.models.OpenAIIntegrationStatusResponse": "Microsoft.Elastic.OpenAIIntegrationStatusResponse", + "azure.mgmt.elastic.models.OpenAIIntegrationStatusResponseProperties": "Microsoft.Elastic.OpenAIIntegrationStatusResponseProperties", + "azure.mgmt.elastic.models.OperationDisplay": "Microsoft.Elastic.OperationDisplay", + "azure.mgmt.elastic.models.OperationResult": "Microsoft.Elastic.OperationResult", + "azure.mgmt.elastic.models.PartnerBillingEntity": "Microsoft.Elastic.PartnerBillingEntity", + "azure.mgmt.elastic.models.PlanDetails": "Microsoft.Elastic.PlanDetails", + "azure.mgmt.elastic.models.ProjectDetails": "Microsoft.Elastic.ProjectDetails", + "azure.mgmt.elastic.models.ResourceProviderDefaultErrorResponse": "Microsoft.Elastic.ResourceProviderDefaultErrorResponse", + "azure.mgmt.elastic.models.ResourceSku": "Microsoft.Elastic.ResourceSku", + "azure.mgmt.elastic.models.ResubscribeProperties": "Microsoft.Elastic.ResubscribeProperties", + "azure.mgmt.elastic.models.SubscriptionList": "Microsoft.Elastic.SubscriptionList", + "azure.mgmt.elastic.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.elastic.models.UpgradableVersionsList": "Microsoft.Elastic.UpgradableVersionsList", + "azure.mgmt.elastic.models.UserApiKeyResponse": "Microsoft.Elastic.UserApiKeyResponse", + "azure.mgmt.elastic.models.UserApiKeyResponseProperties": "Microsoft.Elastic.UserApiKeyResponseProperties", + "azure.mgmt.elastic.models.UserEmailId": "Microsoft.Elastic.UserEmailId", + "azure.mgmt.elastic.models.UserInfo": "Microsoft.Elastic.UserInfo", + "azure.mgmt.elastic.models.VMCollectionUpdate": "Microsoft.Elastic.VMCollectionUpdate", + "azure.mgmt.elastic.models.VMIngestionDetailsResponse": "Microsoft.Elastic.VMIngestionDetailsResponse", + "azure.mgmt.elastic.models.VMResources": "Microsoft.Elastic.VMResources", + "azure.mgmt.elastic.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.elastic.models.Operation": "Microsoft.Elastic.Operation", + "azure.mgmt.elastic.models.Status": "Microsoft.Elastic.Status", + "azure.mgmt.elastic.models.ProvisioningState": "Microsoft.Elastic.ProvisioningState", + "azure.mgmt.elastic.models.TagAction": "Microsoft.Elastic.TagAction", + "azure.mgmt.elastic.models.MonitoringStatus": "Microsoft.Elastic.MonitoringStatus", + "azure.mgmt.elastic.models.LiftrResourceCategories": "Microsoft.Elastic.LiftrResourceCategories", + "azure.mgmt.elastic.models.HostingType": "Microsoft.Elastic.HostingType", + "azure.mgmt.elastic.models.ProjectType": "Microsoft.Elastic.ProjectType", + "azure.mgmt.elastic.models.ConfigurationType": "Microsoft.Elastic.ConfigurationType", + "azure.mgmt.elastic.models.ManagedIdentityTypes": "Microsoft.Elastic.ManagedIdentityTypes", + "azure.mgmt.elastic.models.SendingLogs": "Microsoft.Elastic.SendingLogs", + "azure.mgmt.elastic.models.ElasticDeploymentStatus": "Microsoft.Elastic.ElasticDeploymentStatus", + "azure.mgmt.elastic.models.OperationName": "Microsoft.Elastic.OperationName", + "azure.mgmt.elastic.models.Type": "Microsoft.Elastic.Type", + "azure.mgmt.elastic.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.elastic.aio.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.get": "Microsoft.Elastic.MonitoredSubscriptions.get", + "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.get": "Microsoft.Elastic.MonitoredSubscriptions.get", + "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.begin_createor_update": "Microsoft.Elastic.MonitoredSubscriptions.createorUpdate", + "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.begin_createor_update": "Microsoft.Elastic.MonitoredSubscriptions.createorUpdate", + "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.begin_update": "Microsoft.Elastic.MonitoredSubscriptions.update", + "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.begin_update": "Microsoft.Elastic.MonitoredSubscriptions.update", + "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.begin_delete": "Microsoft.Elastic.MonitoredSubscriptions.delete", + "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.begin_delete": "Microsoft.Elastic.MonitoredSubscriptions.delete", + "azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations.list": "Microsoft.Elastic.MonitoredSubscriptions.list", + "azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations.list": "Microsoft.Elastic.MonitoredSubscriptions.list", + "azure.mgmt.elastic.operations.TagRulesOperations.get": "Microsoft.Elastic.TagRules.get", + "azure.mgmt.elastic.aio.operations.TagRulesOperations.get": "Microsoft.Elastic.TagRules.get", + "azure.mgmt.elastic.operations.TagRulesOperations.create_or_update": "Microsoft.Elastic.TagRules.createOrUpdate", + "azure.mgmt.elastic.aio.operations.TagRulesOperations.create_or_update": "Microsoft.Elastic.TagRules.createOrUpdate", + "azure.mgmt.elastic.operations.TagRulesOperations.begin_delete": "Microsoft.Elastic.TagRules.delete", + "azure.mgmt.elastic.aio.operations.TagRulesOperations.begin_delete": "Microsoft.Elastic.TagRules.delete", + "azure.mgmt.elastic.operations.TagRulesOperations.list": "Microsoft.Elastic.TagRules.list", + "azure.mgmt.elastic.aio.operations.TagRulesOperations.list": "Microsoft.Elastic.TagRules.list", + "azure.mgmt.elastic.operations.MonitorsOperations.get": "Microsoft.Elastic.ElasticMonitorResources.get", + "azure.mgmt.elastic.aio.operations.MonitorsOperations.get": "Microsoft.Elastic.ElasticMonitorResources.get", + "azure.mgmt.elastic.operations.MonitorsOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.create", + "azure.mgmt.elastic.aio.operations.MonitorsOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.create", + "azure.mgmt.elastic.operations.MonitorsOperations.begin_update": "Microsoft.Elastic.ElasticMonitorResources.update", + "azure.mgmt.elastic.aio.operations.MonitorsOperations.begin_update": "Microsoft.Elastic.ElasticMonitorResources.update", + "azure.mgmt.elastic.operations.MonitorsOperations.begin_delete": "Microsoft.Elastic.ElasticMonitorResources.delete", + "azure.mgmt.elastic.aio.operations.MonitorsOperations.begin_delete": "Microsoft.Elastic.ElasticMonitorResources.delete", + "azure.mgmt.elastic.operations.MonitorsOperations.list_by_resource_group": "Microsoft.Elastic.ElasticMonitorResources.listByResourceGroup", + "azure.mgmt.elastic.aio.operations.MonitorsOperations.list_by_resource_group": "Microsoft.Elastic.ElasticMonitorResources.listByResourceGroup", + "azure.mgmt.elastic.operations.MonitorsOperations.list": "Microsoft.Elastic.ElasticMonitorResources.list", + "azure.mgmt.elastic.aio.operations.MonitorsOperations.list": "Microsoft.Elastic.ElasticMonitorResources.list", + "azure.mgmt.elastic.operations.MonitoredResourcesOperations.list": "Microsoft.Elastic.ElasticMonitorResources.monitoredResourcesList", + "azure.mgmt.elastic.aio.operations.MonitoredResourcesOperations.list": "Microsoft.Elastic.ElasticMonitorResources.monitoredResourcesList", + "azure.mgmt.elastic.operations.DeploymentInfoOperations.list": "Microsoft.Elastic.ElasticMonitorResources.deploymentInfoList", + "azure.mgmt.elastic.aio.operations.DeploymentInfoOperations.list": "Microsoft.Elastic.ElasticMonitorResources.deploymentInfoList", + "azure.mgmt.elastic.operations.ExternalUserOperations.create_or_update": "Microsoft.Elastic.ElasticMonitorResources.createOrUpdate", + "azure.mgmt.elastic.aio.operations.ExternalUserOperations.create_or_update": "Microsoft.Elastic.ElasticMonitorResources.createOrUpdate", + "azure.mgmt.elastic.operations.BillingInfoOperations.get": "Microsoft.Elastic.ElasticMonitorResources.billingInfoGet", + "azure.mgmt.elastic.aio.operations.BillingInfoOperations.get": "Microsoft.Elastic.ElasticMonitorResources.billingInfoGet", + "azure.mgmt.elastic.operations.ConnectedPartnerResourcesOperations.list": "Microsoft.Elastic.ElasticMonitorResources.connectedPartnerResourcesList", + "azure.mgmt.elastic.aio.operations.ConnectedPartnerResourcesOperations.list": "Microsoft.Elastic.ElasticMonitorResources.connectedPartnerResourcesList", + "azure.mgmt.elastic.operations.VMHostOperations.list": "Microsoft.Elastic.ElasticMonitorResources.vMHostList", + "azure.mgmt.elastic.aio.operations.VMHostOperations.list": "Microsoft.Elastic.ElasticMonitorResources.vMHostList", + "azure.mgmt.elastic.operations.VMIngestionOperations.details": "Microsoft.Elastic.ElasticMonitorResources.details", + "azure.mgmt.elastic.aio.operations.VMIngestionOperations.details": "Microsoft.Elastic.ElasticMonitorResources.details", + "azure.mgmt.elastic.operations.VMCollectionOperations.update": "Microsoft.Elastic.ElasticMonitorResources.vMCollectionUpdate", + "azure.mgmt.elastic.aio.operations.VMCollectionOperations.update": "Microsoft.Elastic.ElasticMonitorResources.vMCollectionUpdate", + "azure.mgmt.elastic.operations.UpgradableVersionsOperations.details": "Microsoft.Elastic.ElasticMonitorResources.upgradableVersionsDetails", + "azure.mgmt.elastic.aio.operations.UpgradableVersionsOperations.details": "Microsoft.Elastic.ElasticMonitorResources.upgradableVersionsDetails", + "azure.mgmt.elastic.operations.MonitorOperations.begin_upgrade": "Microsoft.Elastic.ElasticMonitorResources.upgrade", + "azure.mgmt.elastic.aio.operations.MonitorOperations.begin_upgrade": "Microsoft.Elastic.ElasticMonitorResources.upgrade", + "azure.mgmt.elastic.operations.AllTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.allTrafficFiltersList", + "azure.mgmt.elastic.aio.operations.AllTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.allTrafficFiltersList", + "azure.mgmt.elastic.operations.listAssociatedTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.listAssociatedTrafficFiltersList", + "azure.mgmt.elastic.aio.operations.listAssociatedTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.listAssociatedTrafficFiltersList", + "azure.mgmt.elastic.operations.createAndAssociateIPFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociateIPFilterCreate", + "azure.mgmt.elastic.aio.operations.createAndAssociateIPFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociateIPFilterCreate", + "azure.mgmt.elastic.operations.createAndAssociatePLFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociatePLFilterCreate", + "azure.mgmt.elastic.aio.operations.createAndAssociatePLFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociatePLFilterCreate", + "azure.mgmt.elastic.operations.AssociateTrafficFilterOperations.begin_associate": "Microsoft.Elastic.ElasticMonitorResources.associate", + "azure.mgmt.elastic.aio.operations.AssociateTrafficFilterOperations.begin_associate": "Microsoft.Elastic.ElasticMonitorResources.associate", + "azure.mgmt.elastic.operations.DetachAndDeleteTrafficFilterOperations.delete": "Microsoft.Elastic.ElasticMonitorResources.detachAndDeleteTrafficFilterDelete", + "azure.mgmt.elastic.aio.operations.DetachAndDeleteTrafficFilterOperations.delete": "Microsoft.Elastic.ElasticMonitorResources.detachAndDeleteTrafficFilterDelete", + "azure.mgmt.elastic.operations.DetachTrafficFilterOperations.begin_update": "Microsoft.Elastic.ElasticMonitorResources.detachTrafficFilterUpdate", + "azure.mgmt.elastic.aio.operations.DetachTrafficFilterOperations.begin_update": "Microsoft.Elastic.ElasticMonitorResources.detachTrafficFilterUpdate", + "azure.mgmt.elastic.operations.TrafficFiltersOperations.delete": "Microsoft.Elastic.ElasticMonitorResources.trafficFiltersDelete", + "azure.mgmt.elastic.aio.operations.TrafficFiltersOperations.delete": "Microsoft.Elastic.ElasticMonitorResources.trafficFiltersDelete", + "azure.mgmt.elastic.operations.OrganizationsOperations.begin_resubscribe": "Microsoft.Elastic.ElasticMonitorResources.resubscribe", + "azure.mgmt.elastic.aio.operations.OrganizationsOperations.begin_resubscribe": "Microsoft.Elastic.ElasticMonitorResources.resubscribe", + "azure.mgmt.elastic.operations.OrganizationsOperations.get_api_key": "Microsoft.Elastic.OrganizationsOperationGroup.getApiKey", + "azure.mgmt.elastic.aio.operations.OrganizationsOperations.get_api_key": "Microsoft.Elastic.OrganizationsOperationGroup.getApiKey", + "azure.mgmt.elastic.operations.OrganizationsOperations.get_elastic_to_azure_subscription_mapping": "Microsoft.Elastic.OrganizationsOperationGroup.getElasticToAzureSubscriptionMapping", + "azure.mgmt.elastic.aio.operations.OrganizationsOperations.get_elastic_to_azure_subscription_mapping": "Microsoft.Elastic.OrganizationsOperationGroup.getElasticToAzureSubscriptionMapping", + "azure.mgmt.elastic.operations.OpenAIOperations.get": "Microsoft.Elastic.OpenAIIntegrationRPModels.get", + "azure.mgmt.elastic.aio.operations.OpenAIOperations.get": "Microsoft.Elastic.OpenAIIntegrationRPModels.get", + "azure.mgmt.elastic.operations.OpenAIOperations.create_or_update": "Microsoft.Elastic.OpenAIIntegrationRPModels.createOrUpdate", + "azure.mgmt.elastic.aio.operations.OpenAIOperations.create_or_update": "Microsoft.Elastic.OpenAIIntegrationRPModels.createOrUpdate", + "azure.mgmt.elastic.operations.OpenAIOperations.delete": "Microsoft.Elastic.OpenAIIntegrationRPModels.delete", + "azure.mgmt.elastic.aio.operations.OpenAIOperations.delete": "Microsoft.Elastic.OpenAIIntegrationRPModels.delete", + "azure.mgmt.elastic.operations.OpenAIOperations.list": "Microsoft.Elastic.OpenAIIntegrationRPModels.list", + "azure.mgmt.elastic.aio.operations.OpenAIOperations.list": "Microsoft.Elastic.OpenAIIntegrationRPModels.list", + "azure.mgmt.elastic.operations.OpenAIOperations.get_status": "Microsoft.Elastic.OpenAIIntegrationRPModels.getStatus", + "azure.mgmt.elastic.aio.operations.OpenAIOperations.get_status": "Microsoft.Elastic.OpenAIIntegrationRPModels.getStatus", + "azure.mgmt.elastic.operations.ElasticVersionsOperations.list": "Microsoft.Elastic.ElasticVersionsOperationGroup.list", + "azure.mgmt.elastic.aio.operations.ElasticVersionsOperations.list": "Microsoft.Elastic.ElasticVersionsOperationGroup.list" + }, + "CrossLanguageVersion": "17c14004697f" } \ No newline at end of file diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py index 5f4526be9b33..560df7bed8dc 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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 @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._microsoft_elastic import MicrosoftElastic # type: ignore +from ._client import ElasticMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION @@ -25,7 +25,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftElastic", + "ElasticMgmtClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_client.py similarity index 84% rename from sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py rename to sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_client.py index 9a8f36dfa061..e08b7cde318d 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_client.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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 +import sys 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 @@ -17,22 +17,18 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models -from ._configuration import MicrosoftElasticConfiguration +from ._configuration import ElasticMgmtClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( AllTrafficFiltersOperations, AssociateTrafficFilterOperations, BillingInfoOperations, ConnectedPartnerResourcesOperations, - CreateAndAssociateIPFilterOperations, - CreateAndAssociatePLFilterOperations, DeploymentInfoOperations, DetachAndDeleteTrafficFilterOperations, DetachTrafficFilterOperations, ElasticVersionsOperations, ExternalUserOperations, - ListAssociatedTrafficFiltersOperations, MonitorOperations, MonitoredResourcesOperations, MonitoredSubscriptionsOperations, @@ -46,25 +42,33 @@ VMCollectionOperations, VMHostOperations, VMIngestionOperations, + createAndAssociateIPFilterOperations, + createAndAssociatePLFilterOperations, + listAssociatedTrafficFiltersOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class MicrosoftElastic: # pylint: disable=too-many-instance-attributes - """MicrosoftElastic. +class ElasticMgmtClient: # pylint: disable=too-many-instance-attributes + """ElasticMgmtClient. :ivar operations: Operations operations :vartype operations: azure.mgmt.elastic.operations.Operations - :ivar monitors: MonitorsOperations operations - :vartype monitors: azure.mgmt.elastic.operations.MonitorsOperations - :ivar elastic_versions: ElasticVersionsOperations operations - :vartype elastic_versions: azure.mgmt.elastic.operations.ElasticVersionsOperations :ivar monitored_subscriptions: MonitoredSubscriptionsOperations operations :vartype monitored_subscriptions: azure.mgmt.elastic.operations.MonitoredSubscriptionsOperations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: azure.mgmt.elastic.operations.TagRulesOperations + :ivar monitors: MonitorsOperations operations + :vartype monitors: azure.mgmt.elastic.operations.MonitorsOperations :ivar monitored_resources: MonitoredResourcesOperations operations :vartype monitored_resources: azure.mgmt.elastic.operations.MonitoredResourcesOperations :ivar deployment_info: DeploymentInfoOperations operations @@ -76,10 +80,6 @@ class MicrosoftElastic: # pylint: disable=too-many-instance-attributes :ivar connected_partner_resources: ConnectedPartnerResourcesOperations operations :vartype connected_partner_resources: azure.mgmt.elastic.operations.ConnectedPartnerResourcesOperations - :ivar open_ai: OpenAIOperations operations - :vartype open_ai: azure.mgmt.elastic.operations.OpenAIOperations - :ivar tag_rules: TagRulesOperations operations - :vartype tag_rules: azure.mgmt.elastic.operations.TagRulesOperations :ivar vm_host: VMHostOperations operations :vartype vm_host: azure.mgmt.elastic.operations.VMHostOperations :ivar vm_ingestion: VMIngestionOperations operations @@ -92,15 +92,15 @@ class MicrosoftElastic: # pylint: disable=too-many-instance-attributes :vartype monitor: azure.mgmt.elastic.operations.MonitorOperations :ivar all_traffic_filters: AllTrafficFiltersOperations operations :vartype all_traffic_filters: azure.mgmt.elastic.operations.AllTrafficFiltersOperations - :ivar list_associated_traffic_filters: ListAssociatedTrafficFiltersOperations operations + :ivar list_associated_traffic_filters: listAssociatedTrafficFiltersOperations operations :vartype list_associated_traffic_filters: - azure.mgmt.elastic.operations.ListAssociatedTrafficFiltersOperations - :ivar create_and_associate_ip_filter: CreateAndAssociateIPFilterOperations operations + azure.mgmt.elastic.operations.listAssociatedTrafficFiltersOperations + :ivar create_and_associate_ip_filter: createAndAssociateIPFilterOperations operations :vartype create_and_associate_ip_filter: - azure.mgmt.elastic.operations.CreateAndAssociateIPFilterOperations - :ivar create_and_associate_pl_filter: CreateAndAssociatePLFilterOperations operations + azure.mgmt.elastic.operations.createAndAssociateIPFilterOperations + :ivar create_and_associate_pl_filter: createAndAssociatePLFilterOperations operations :vartype create_and_associate_pl_filter: - azure.mgmt.elastic.operations.CreateAndAssociatePLFilterOperations + azure.mgmt.elastic.operations.createAndAssociatePLFilterOperations :ivar associate_traffic_filter: AssociateTrafficFilterOperations operations :vartype associate_traffic_filter: azure.mgmt.elastic.operations.AssociateTrafficFilterOperations @@ -113,17 +113,22 @@ class MicrosoftElastic: # pylint: disable=too-many-instance-attributes :vartype traffic_filters: azure.mgmt.elastic.operations.TrafficFiltersOperations :ivar organizations: OrganizationsOperations operations :vartype organizations: azure.mgmt.elastic.operations.OrganizationsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar open_ai: OpenAIOperations operations + :vartype open_ai: azure.mgmt.elastic.operations.OpenAIOperations + :ivar elastic_versions: ElasticVersionsOperations operations + :vartype elastic_versions: azure.mgmt.elastic.operations.ElasticVersionsOperations + :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 URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-06-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-06-01" + and None. Default value is None. If not set, the operation's default API version will be used. + 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. @@ -138,14 +143,16 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting 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 = MicrosoftElasticConfiguration( + self._config = ElasticMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -169,20 +176,17 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.elastic_versions = ElasticVersionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.monitored_subscriptions = MonitoredSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) self.monitored_resources = MonitoredResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -192,8 +196,6 @@ def __init__( self.connected_partner_resources = ConnectedPartnerResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.open_ai = OpenAIOperations(self._client, self._config, self._serialize, self._deserialize) - self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_host = VMHostOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_ingestion = VMIngestionOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_collection = VMCollectionOperations(self._client, self._config, self._serialize, self._deserialize) @@ -204,13 +206,13 @@ def __init__( self.all_traffic_filters = AllTrafficFiltersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.list_associated_traffic_filters = ListAssociatedTrafficFiltersOperations( + self.list_associated_traffic_filters = listAssociatedTrafficFiltersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.create_and_associate_ip_filter = CreateAndAssociateIPFilterOperations( + self.create_and_associate_ip_filter = createAndAssociateIPFilterOperations( self._client, self._config, self._serialize, self._deserialize ) - self.create_and_associate_pl_filter = CreateAndAssociatePLFilterOperations( + self.create_and_associate_pl_filter = createAndAssociatePLFilterOperations( self._client, self._config, self._serialize, self._deserialize ) self.associate_traffic_filter = AssociateTrafficFilterOperations( @@ -224,14 +226,18 @@ def __init__( ) self.traffic_filters = TrafficFiltersOperations(self._client, self._config, self._serialize, self._deserialize) self.organizations = OrganizationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_ai = OpenAIOperations(self._client, self._config, self._serialize, self._deserialize) + self.elastic_versions = ElasticVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + 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) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -244,7 +250,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + 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: diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py index 1bc736897110..2b52c10bee1f 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- @@ -18,21 +18,24 @@ from azure.core.credentials import TokenCredential -class MicrosoftElasticConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for MicrosoftElastic. +class ElasticMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ElasticMgmtClient. 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 + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-06-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-06-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -40,6 +43,7 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: @@ -52,6 +56,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_patch.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_patch.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# 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 """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/__init__.py @@ -1,6 +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) 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. # -------------------------------------------------------------------------- diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/model_base.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/model_base.py new file mode 100644 index 000000000000..b93f5120d517 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/model_base.py @@ -0,0 +1,1770 @@ +# 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=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 +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 + +from azure.core.rest import HttpResponse + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +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_duration(td: timedelta, format: typing.Optional[str] = None): + """Serialize a timedelta to its wire representation. + + For the ``seconds``/``milliseconds`` encodings the value is converted to a + numeric value, otherwise it falls back to an ISO 8601 duration string. + + :param timedelta td: The timedelta to serialize. + :param str format: The duration encoding format. + :rtype: int or float or str + :return: serialized duration + """ + seconds = td.total_seconds() + if format == "duration-seconds-int": + return int(seconds) + if format == "duration-seconds-float": + return seconds + if format == "duration-milliseconds-int": + return int(seconds * 1000) + if format == "duration-milliseconds-float": + return seconds * 1000 + return _timedelta_as_isostr(td) + + +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" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +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 # type: ignore[no-any-return] + + +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) # type: ignore[no-any-return] + + +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_duration_numeric(attr, unit): + if isinstance(attr, timedelta): + return attr + return timedelta(**{unit: float(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, + "duration-seconds-int": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-seconds-float": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-milliseconds-int": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), + "duration-milliseconds-float": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), +} + + +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 annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + 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: 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: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + 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) -> 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: + if isinstance(other, _MyMutableMapping): + return self._data == other._data + 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): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + 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 _serialize_duration(o, format) + 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: 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) + + +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param +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: 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: dict[str, typing.Any] = {} + if args: + if isinstance(args[0], ET.Element): + dict_to_pass.update(self._init_from_xml(args[0])) + 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 + } + ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) + super().__init__(dict_to_pass) + + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + existed_attr_keys: list[str] = [] + + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + 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 = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + + 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: 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: dict[str, _RestField] = dict(attr_to_rest_field.items()) + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) + 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 = _resolve_xml_ns(prop_meta, model_meta) + 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) -> 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: 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: 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 _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + +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) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> 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-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 is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), 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 is not _NONE_TYPE] # 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: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + 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: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + 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 and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) 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.text if isinstance(value, ET.Element) else value) + except ValueError: + # for unknown value, return raw value + return value.text if isinstance(value, ET.Element) else 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, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except + _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, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +# pylint: disable=too-many-instance-attributes +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[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = 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._is_optional = 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 {} + self._deserializer = deserializer + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @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 + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + 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[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = 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, + deserializer=deserializer, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[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_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, 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: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) + wrapped_element = _create_xml_element( + element_name, + model_meta.get("prefix"), + _model_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} + + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. + 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): + _set_xml_attribute(wrapped_element, k, v, prop_meta) + 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 = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": _dict_ns, + "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: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(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": _items_ns, + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + _meta_ns = _get_xml_ns(meta) if meta else None + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns + ) + 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 # type: ignore[no-any-return] + + +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 _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: + ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + _safe_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 + if _is_model(deserializer): + return deserializer._deserialize(element, []) + 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: 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: 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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/serialization.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/serialization.py index ff543ed937ff..75906e2eb77f 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/serialization.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -516,6 +520,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Serializer.serialize_rfc, "unix-time": Serializer.serialize_unix, "duration": Serializer.serialize_duration, + "duration-seconds-int": Serializer.serialize_duration_seconds_int, + "duration-seconds-float": Serializer.serialize_duration_seconds_float, + "duration-milliseconds-int": Serializer.serialize_duration_milliseconds_int, + "duration-milliseconds-float": Serializer.serialize_duration_milliseconds_float, "date": Serializer.serialize_date, "time": Serializer.serialize_time, "decimal": Serializer.serialize_decimal, @@ -821,13 +829,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1098,6 +1113,61 @@ def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) + @staticmethod + def _serialize_duration_numeric(attr, scale, as_int): + """Serialize a TimeDelta into a numeric value scaled to the wire unit. + + :param TimeDelta attr: Object to be serialized. + :param int scale: Multiplier applied to total seconds (1 for seconds, 1000 for milliseconds). + :param bool as_int: Whether to truncate the result to an int. + :rtype: int or float + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + value = attr.total_seconds() * scale if isinstance(attr, datetime.timedelta) else attr + return int(value) if as_int else float(value) + + @staticmethod + def serialize_duration_seconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, True) + + @staticmethod + def serialize_duration_seconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, False) + + @staticmethod + def serialize_duration_milliseconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, True) + + @staticmethod + def serialize_duration_milliseconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, False) + @staticmethod def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. @@ -1370,6 +1440,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Deserializer.deserialize_rfc, "unix-time": Deserializer.deserialize_unix, "duration": Deserializer.deserialize_duration, + "duration-seconds-int": Deserializer.deserialize_duration_seconds, + "duration-seconds-float": Deserializer.deserialize_duration_seconds, + "duration-milliseconds-int": Deserializer.deserialize_duration_milliseconds, + "duration-milliseconds-float": Deserializer.deserialize_duration_milliseconds, "date": Deserializer.deserialize_date, "time": Deserializer.deserialize_time, "decimal": Deserializer.deserialize_decimal, @@ -1382,6 +1456,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: } self.deserialize_expected_types = { "duration": (isodate.Duration, datetime.timedelta), + "duration-seconds-int": (isodate.Duration, datetime.timedelta), + "duration-seconds-float": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-int": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-float": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } self.dependencies: dict[str, type] = dict(classes) if classes else {} @@ -1394,7 +1472,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1404,6 +1482,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) @@ -1757,7 +1856,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :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 or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1783,7 +1882,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): @@ -1918,6 +2021,48 @@ def deserialize_duration(attr): raise DeserializationError(msg) from err return duration + @staticmethod + def _deserialize_duration_numeric(attr, unit): + """Deserialize a numeric duration value into a TimeDelta object. + + :param float attr: response value to be deserialized. + :param str unit: The wire unit, used as the ``timedelta`` keyword + (``"seconds"`` or ``"milliseconds"``). + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = datetime.timedelta(**{unit: float(attr)}) # type: ignore + except (ValueError, OverflowError, TypeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_duration_seconds(attr): + """Deserialize a numeric number of seconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "seconds") + + @staticmethod + def deserialize_duration_milliseconds(attr): + """Deserialize a numeric number of milliseconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "milliseconds") + @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py index 48944bf3938a..fd5e9189cf06 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_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 = "2.0.0" +VERSION = "3.0.0b1" diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py index 15c4c4b8dbeb..db4f3b89bfc0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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 @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._microsoft_elastic import MicrosoftElastic # type: ignore +from ._client import ElasticMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all @@ -22,7 +22,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftElastic", + "ElasticMgmtClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_client.py similarity index 85% rename from sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py rename to sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_client.py index 1311cf4d1500..c8b4d7900394 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_client.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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 +import sys 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 @@ -17,22 +17,18 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer -from ._configuration import MicrosoftElasticConfiguration +from ._configuration import ElasticMgmtClientConfiguration from .operations import ( AllTrafficFiltersOperations, AssociateTrafficFilterOperations, BillingInfoOperations, ConnectedPartnerResourcesOperations, - CreateAndAssociateIPFilterOperations, - CreateAndAssociatePLFilterOperations, DeploymentInfoOperations, DetachAndDeleteTrafficFilterOperations, DetachTrafficFilterOperations, ElasticVersionsOperations, ExternalUserOperations, - ListAssociatedTrafficFiltersOperations, MonitorOperations, MonitoredResourcesOperations, MonitoredSubscriptionsOperations, @@ -46,25 +42,33 @@ VMCollectionOperations, VMHostOperations, VMIngestionOperations, + createAndAssociateIPFilterOperations, + createAndAssociatePLFilterOperations, + listAssociatedTrafficFiltersOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftElastic: # pylint: disable=too-many-instance-attributes - """MicrosoftElastic. +class ElasticMgmtClient: # pylint: disable=too-many-instance-attributes + """ElasticMgmtClient. :ivar operations: Operations operations :vartype operations: azure.mgmt.elastic.aio.operations.Operations - :ivar monitors: MonitorsOperations operations - :vartype monitors: azure.mgmt.elastic.aio.operations.MonitorsOperations - :ivar elastic_versions: ElasticVersionsOperations operations - :vartype elastic_versions: azure.mgmt.elastic.aio.operations.ElasticVersionsOperations :ivar monitored_subscriptions: MonitoredSubscriptionsOperations operations :vartype monitored_subscriptions: azure.mgmt.elastic.aio.operations.MonitoredSubscriptionsOperations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: azure.mgmt.elastic.aio.operations.TagRulesOperations + :ivar monitors: MonitorsOperations operations + :vartype monitors: azure.mgmt.elastic.aio.operations.MonitorsOperations :ivar monitored_resources: MonitoredResourcesOperations operations :vartype monitored_resources: azure.mgmt.elastic.aio.operations.MonitoredResourcesOperations :ivar deployment_info: DeploymentInfoOperations operations @@ -76,10 +80,6 @@ class MicrosoftElastic: # pylint: disable=too-many-instance-attributes :ivar connected_partner_resources: ConnectedPartnerResourcesOperations operations :vartype connected_partner_resources: azure.mgmt.elastic.aio.operations.ConnectedPartnerResourcesOperations - :ivar open_ai: OpenAIOperations operations - :vartype open_ai: azure.mgmt.elastic.aio.operations.OpenAIOperations - :ivar tag_rules: TagRulesOperations operations - :vartype tag_rules: azure.mgmt.elastic.aio.operations.TagRulesOperations :ivar vm_host: VMHostOperations operations :vartype vm_host: azure.mgmt.elastic.aio.operations.VMHostOperations :ivar vm_ingestion: VMIngestionOperations operations @@ -92,15 +92,15 @@ class MicrosoftElastic: # pylint: disable=too-many-instance-attributes :vartype monitor: azure.mgmt.elastic.aio.operations.MonitorOperations :ivar all_traffic_filters: AllTrafficFiltersOperations operations :vartype all_traffic_filters: azure.mgmt.elastic.aio.operations.AllTrafficFiltersOperations - :ivar list_associated_traffic_filters: ListAssociatedTrafficFiltersOperations operations + :ivar list_associated_traffic_filters: listAssociatedTrafficFiltersOperations operations :vartype list_associated_traffic_filters: - azure.mgmt.elastic.aio.operations.ListAssociatedTrafficFiltersOperations - :ivar create_and_associate_ip_filter: CreateAndAssociateIPFilterOperations operations + azure.mgmt.elastic.aio.operations.listAssociatedTrafficFiltersOperations + :ivar create_and_associate_ip_filter: createAndAssociateIPFilterOperations operations :vartype create_and_associate_ip_filter: - azure.mgmt.elastic.aio.operations.CreateAndAssociateIPFilterOperations - :ivar create_and_associate_pl_filter: CreateAndAssociatePLFilterOperations operations + azure.mgmt.elastic.aio.operations.createAndAssociateIPFilterOperations + :ivar create_and_associate_pl_filter: createAndAssociatePLFilterOperations operations :vartype create_and_associate_pl_filter: - azure.mgmt.elastic.aio.operations.CreateAndAssociatePLFilterOperations + azure.mgmt.elastic.aio.operations.createAndAssociatePLFilterOperations :ivar associate_traffic_filter: AssociateTrafficFilterOperations operations :vartype associate_traffic_filter: azure.mgmt.elastic.aio.operations.AssociateTrafficFilterOperations @@ -113,17 +113,22 @@ class MicrosoftElastic: # pylint: disable=too-many-instance-attributes :vartype traffic_filters: azure.mgmt.elastic.aio.operations.TrafficFiltersOperations :ivar organizations: OrganizationsOperations operations :vartype organizations: azure.mgmt.elastic.aio.operations.OrganizationsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar open_ai: OpenAIOperations operations + :vartype open_ai: azure.mgmt.elastic.aio.operations.OpenAIOperations + :ivar elastic_versions: ElasticVersionsOperations operations + :vartype elastic_versions: azure.mgmt.elastic.aio.operations.ElasticVersionsOperations + :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 None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-06-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-06-01" + and None. Default value is None. If not set, the operation's default API version will be used. + 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. @@ -138,14 +143,16 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting 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 = MicrosoftElasticConfiguration( + self._config = ElasticMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -170,21 +177,18 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), policies=_policies, **kwargs ) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.elastic_versions = ElasticVersionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.monitored_subscriptions = MonitoredSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) self.monitored_resources = MonitoredResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -194,8 +198,6 @@ def __init__( self.connected_partner_resources = ConnectedPartnerResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.open_ai = OpenAIOperations(self._client, self._config, self._serialize, self._deserialize) - self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_host = VMHostOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_ingestion = VMIngestionOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_collection = VMCollectionOperations(self._client, self._config, self._serialize, self._deserialize) @@ -206,13 +208,13 @@ def __init__( self.all_traffic_filters = AllTrafficFiltersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.list_associated_traffic_filters = ListAssociatedTrafficFiltersOperations( + self.list_associated_traffic_filters = listAssociatedTrafficFiltersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.create_and_associate_ip_filter = CreateAndAssociateIPFilterOperations( + self.create_and_associate_ip_filter = createAndAssociateIPFilterOperations( self._client, self._config, self._serialize, self._deserialize ) - self.create_and_associate_pl_filter = CreateAndAssociatePLFilterOperations( + self.create_and_associate_pl_filter = createAndAssociatePLFilterOperations( self._client, self._config, self._serialize, self._deserialize ) self.associate_traffic_filter = AssociateTrafficFilterOperations( @@ -226,8 +228,12 @@ def __init__( ) self.traffic_filters = TrafficFiltersOperations(self._client, self._config, self._serialize, self._deserialize) self.organizations = OrganizationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_ai = OpenAIOperations(self._client, self._config, self._serialize, self._deserialize) + self.elastic_versions = ElasticVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -235,7 +241,7 @@ def _send_request( >>> 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 @@ -248,7 +254,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + 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: diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py index a313de2441b6..8ef55f4f8abc 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- @@ -18,21 +18,24 @@ from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftElasticConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for MicrosoftElastic. +class ElasticMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ElasticMgmtClient. 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 + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-06-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-06-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -40,6 +43,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: @@ -52,6 +56,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_patch.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_patch.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# 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 """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py index d920cd5fb72c..829239b82bd0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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 @@ -13,30 +13,30 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._monitors_operations import MonitorsOperations # type: ignore -from ._elastic_versions_operations import ElasticVersionsOperations # type: ignore -from ._monitored_subscriptions_operations import MonitoredSubscriptionsOperations # type: ignore -from ._monitored_resources_operations import MonitoredResourcesOperations # type: ignore -from ._deployment_info_operations import DeploymentInfoOperations # type: ignore -from ._external_user_operations import ExternalUserOperations # type: ignore -from ._billing_info_operations import BillingInfoOperations # type: ignore -from ._connected_partner_resources_operations import ConnectedPartnerResourcesOperations # type: ignore -from ._open_ai_operations import OpenAIOperations # type: ignore -from ._tag_rules_operations import TagRulesOperations # type: ignore -from ._vm_host_operations import VMHostOperations # type: ignore -from ._vm_ingestion_operations import VMIngestionOperations # type: ignore -from ._vm_collection_operations import VMCollectionOperations # type: ignore -from ._upgradable_versions_operations import UpgradableVersionsOperations # type: ignore -from ._monitor_operations import MonitorOperations # type: ignore -from ._all_traffic_filters_operations import AllTrafficFiltersOperations # type: ignore -from ._list_associated_traffic_filters_operations import ListAssociatedTrafficFiltersOperations # type: ignore -from ._create_and_associate_ip_filter_operations import CreateAndAssociateIPFilterOperations # type: ignore -from ._create_and_associate_pl_filter_operations import CreateAndAssociatePLFilterOperations # type: ignore -from ._associate_traffic_filter_operations import AssociateTrafficFilterOperations # type: ignore -from ._detach_and_delete_traffic_filter_operations import DetachAndDeleteTrafficFilterOperations # type: ignore -from ._detach_traffic_filter_operations import DetachTrafficFilterOperations # type: ignore -from ._traffic_filters_operations import TrafficFiltersOperations # type: ignore -from ._organizations_operations import OrganizationsOperations # type: ignore +from ._operations import MonitoredSubscriptionsOperations # type: ignore +from ._operations import TagRulesOperations # type: ignore +from ._operations import MonitorsOperations # type: ignore +from ._operations import MonitoredResourcesOperations # type: ignore +from ._operations import DeploymentInfoOperations # type: ignore +from ._operations import ExternalUserOperations # type: ignore +from ._operations import BillingInfoOperations # type: ignore +from ._operations import ConnectedPartnerResourcesOperations # type: ignore +from ._operations import VMHostOperations # type: ignore +from ._operations import VMIngestionOperations # type: ignore +from ._operations import VMCollectionOperations # type: ignore +from ._operations import UpgradableVersionsOperations # type: ignore +from ._operations import MonitorOperations # type: ignore +from ._operations import AllTrafficFiltersOperations # type: ignore +from ._operations import listAssociatedTrafficFiltersOperations # type: ignore +from ._operations import createAndAssociateIPFilterOperations # type: ignore +from ._operations import createAndAssociatePLFilterOperations # type: ignore +from ._operations import AssociateTrafficFilterOperations # type: ignore +from ._operations import DetachAndDeleteTrafficFilterOperations # type: ignore +from ._operations import DetachTrafficFilterOperations # type: ignore +from ._operations import TrafficFiltersOperations # type: ignore +from ._operations import OrganizationsOperations # type: ignore +from ._operations import OpenAIOperations # type: ignore +from ._operations import ElasticVersionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -44,30 +44,30 @@ __all__ = [ "Operations", - "MonitorsOperations", - "ElasticVersionsOperations", "MonitoredSubscriptionsOperations", + "TagRulesOperations", + "MonitorsOperations", "MonitoredResourcesOperations", "DeploymentInfoOperations", "ExternalUserOperations", "BillingInfoOperations", "ConnectedPartnerResourcesOperations", - "OpenAIOperations", - "TagRulesOperations", "VMHostOperations", "VMIngestionOperations", "VMCollectionOperations", "UpgradableVersionsOperations", "MonitorOperations", "AllTrafficFiltersOperations", - "ListAssociatedTrafficFiltersOperations", - "CreateAndAssociateIPFilterOperations", - "CreateAndAssociatePLFilterOperations", + "listAssociatedTrafficFiltersOperations", + "createAndAssociateIPFilterOperations", + "createAndAssociatePLFilterOperations", "AssociateTrafficFilterOperations", "DetachAndDeleteTrafficFilterOperations", "DetachTrafficFilterOperations", "TrafficFiltersOperations", "OrganizationsOperations", + "OpenAIOperations", + "ElasticVersionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py deleted file mode 100644 index 03b7c7871c7a..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py +++ /dev/null @@ -1,117 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._all_traffic_filters_operations import build_list_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class AllTrafficFiltersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`all_traffic_filters` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 list( - self, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> _models.ElasticTrafficFilterResponse: - """List all traffic filters associated with your Elastic monitor resource, helping you manage - network traffic control. - - List all traffic filters associated with your Elastic monitor resource, helping you manage - network traffic control. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: ElasticTrafficFilterResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ElasticTrafficFilterResponse - :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 = 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.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ElasticTrafficFilterResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py deleted file mode 100644 index 4de36909a9a8..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py +++ /dev/null @@ -1,175 +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 collections.abc import MutableMapping -from typing import Any, AsyncIterator, Callable, Optional, TypeVar, Union, cast - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_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 ..._utils.serialization import Deserializer, Serializer -from ...operations._associate_traffic_filter_operations import build_associate_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class AssociateTrafficFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`associate_traffic_filter` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _associate_initial( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_associate_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ruleset_id=ruleset_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_associate( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Associate a traffic filter with your Elastic monitor resource to control and manage network - traffic. - - Associate a traffic filter with your Elastic monitor resource to control and manage network - traffic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ruleset_id: Ruleset Id of the filter. Default value is None. - :type ruleset_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._associate_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - ruleset_id=ruleset_id, - api_version=api_version, - 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 - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_billing_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_billing_info_operations.py deleted file mode 100644 index c2fae69d7311..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_billing_info_operations.py +++ /dev/null @@ -1,115 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._billing_info_operations import build_get_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class BillingInfoOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`billing_info` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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, monitor_name: str, **kwargs: Any) -> _models.BillingInfoResponse: - """Retrieve marketplace and organization billing information mapped to the given Elastic monitor - resource. - - Retrieve marketplace and organization billing information mapped to the given Elastic monitor - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: BillingInfoResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.BillingInfoResponse - :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 = 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.BillingInfoResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BillingInfoResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_connected_partner_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_connected_partner_resources_operations.py deleted file mode 100644 index c3c248cdf26a..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_connected_partner_resources_operations.py +++ /dev/null @@ -1,147 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._connected_partner_resources_operations import build_list_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ConnectedPartnerResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`connected_partner_resources` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ConnectedPartnerResourcesListFormat"]: - """List all active deployments associated with the marketplace subscription linked to the given - Elastic monitor resource. - - List all active deployments associated with the marketplace subscription linked to the given - Elastic monitor resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either ConnectedPartnerResourcesListFormat or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] - :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.ConnectedPartnerResourcesListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ConnectedPartnerResourcesListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py deleted file mode 100644 index 1b3d05cc085b..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py +++ /dev/null @@ -1,189 +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 collections.abc import MutableMapping -from typing import Any, AsyncIterator, Callable, Optional, TypeVar, Union, cast - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_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 ..._utils.serialization import Deserializer, Serializer -from ...operations._create_and_associate_ip_filter_operations import build_create_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CreateAndAssociateIPFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`create_and_associate_ip_filter` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _create_initial( - self, - resource_group_name: str, - monitor_name: str, - ips: Optional[str] = None, - name: Optional[str] = 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ips=ips, - name=name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - monitor_name: str, - ips: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create and associate an IP filter with your Elastic monitor resource to control and manage - network traffic. - - Create and associate an IP filter with your Elastic monitor resource to control and manage - network traffic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ips: List of ips. Default value is None. - :type ips: str - :param name: Name of the traffic filter. Default value is None. - :type name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - ips=ips, - name=name, - api_version=api_version, - 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 - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py deleted file mode 100644 index aca4514912fd..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py +++ /dev/null @@ -1,195 +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 collections.abc import MutableMapping -from typing import Any, AsyncIterator, Callable, Optional, TypeVar, Union, cast - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_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 ..._utils.serialization import Deserializer, Serializer -from ...operations._create_and_associate_pl_filter_operations import build_create_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CreateAndAssociatePLFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`create_and_associate_pl_filter` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _create_initial( - self, - resource_group_name: str, - monitor_name: str, - name: Optional[str] = None, - private_endpoint_guid: Optional[str] = None, - private_endpoint_name: Optional[str] = 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - name=name, - private_endpoint_guid=private_endpoint_guid, - private_endpoint_name=private_endpoint_name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - monitor_name: str, - name: Optional[str] = None, - private_endpoint_guid: Optional[str] = None, - private_endpoint_name: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create and associate a PL filter with your Elastic monitor resource to control and manage - network traffic. - - Create and associate a PL filter with your Elastic monitor resource to control and manage - network traffic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param name: Name of the traffic filter. Default value is None. - :type name: str - :param private_endpoint_guid: Guid of the private endpoint. Default value is None. - :type private_endpoint_guid: str - :param private_endpoint_name: Name of the private endpoint. Default value is None. - :type private_endpoint_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - name=name, - private_endpoint_guid=private_endpoint_guid, - private_endpoint_name=private_endpoint_name, - api_version=api_version, - 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 - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py deleted file mode 100644 index 59dcff15bc00..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py +++ /dev/null @@ -1,115 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._deployment_info_operations import build_list_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DeploymentInfoOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`deployment_info` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.DeploymentInfoResponse: - """Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor - resource. - - Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: DeploymentInfoResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.DeploymentInfoResponse - :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 = 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.DeploymentInfoResponse] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeploymentInfoResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py deleted file mode 100644 index 3621a249a1f3..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py +++ /dev/null @@ -1,116 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._detach_and_delete_traffic_filter_operations import build_delete_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DetachAndDeleteTrafficFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`detach_and_delete_traffic_filter` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 delete( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = None, **kwargs: Any - ) -> None: - """Detach and delete an existing traffic filter from your Elastic monitor resource, removing its - network traffic control capabilities. - - Detach and delete an existing traffic filter from your Elastic monitor resource, removing its - network traffic control capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ruleset_id: Ruleset Id of the filter. Default value is None. - :type ruleset_id: str - :return: None or the result of cls(response) - :rtype: None - :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 = 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, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ruleset_id=ruleset_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py deleted file mode 100644 index c681255a8d72..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py +++ /dev/null @@ -1,175 +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 collections.abc import MutableMapping -from typing import Any, AsyncIterator, Callable, Optional, TypeVar, Union, cast - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_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 ..._utils.serialization import Deserializer, Serializer -from ...operations._detach_traffic_filter_operations import build_update_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DetachTrafficFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`detach_traffic_filter` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _update_initial( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ruleset_id=ruleset_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_update( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Detach an existing traffic filter from your Elastic monitor resource, removing its network - traffic control capabilities. - - Detach an existing traffic filter from your Elastic monitor resource, removing its network - traffic control capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ruleset_id: Ruleset Id of the filter. Default value is None. - :type ruleset_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - ruleset_id=ruleset_id, - api_version=api_version, - 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 - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_elastic_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_elastic_versions_operations.py deleted file mode 100644 index bfccb9ccc3ce..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_elastic_versions_operations.py +++ /dev/null @@ -1,141 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._elastic_versions_operations import build_list_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ElasticVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`elastic_versions` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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, region: str, **kwargs: Any) -> AsyncItemPaged["_models.ElasticVersionListFormat"]: - """Retrieve a list of all available Elastic versions for a specified region, helping you choose - the best version for your deployment. - - Retrieve a list of all available Elastic versions for a specified region, helping you choose - the best version for your deployment. - - :param region: Region where elastic deployment will take place. Required. - :type region: str - :return: An iterator like instance of either ElasticVersionListFormat or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticVersionListFormat] - :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.ElasticVersionsListResponse] = 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_list_request( - subscription_id=self._config.subscription_id, - region=region, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ElasticVersionsListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py deleted file mode 100644 index f4cfa0269df7..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py +++ /dev/null @@ -1,203 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._external_user_operations import build_create_or_update_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ExternalUserOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`external_user` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 create_or_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.ExternalUserInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ExternalUserCreationResponse: - """Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic External User Creation Parameters. Default value is None. - :type body: ~azure.mgmt.elastic.models.ExternalUserInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ExternalUserCreationResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ExternalUserCreationResponse: - """Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic External User Creation Parameters. 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: ExternalUserCreationResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ExternalUserInfo, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.ExternalUserCreationResponse: - """Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic External User Creation Parameters. Is either a ExternalUserInfo type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ExternalUserInfo or IO[bytes] - :return: ExternalUserCreationResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[_models.ExternalUserCreationResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ExternalUserInfo") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ExternalUserCreationResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py deleted file mode 100644 index b3edfa844ab3..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py +++ /dev/null @@ -1,117 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._list_associated_traffic_filters_operations import build_list_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ListAssociatedTrafficFiltersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`list_associated_traffic_filters` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 list( - self, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> _models.ElasticTrafficFilterResponse: - """List all traffic filters associated with your Elastic monitor resource, helping you manage - network traffic control. - - List all traffic filters associated with your Elastic monitor resource, helping you manage - network traffic control. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: ElasticTrafficFilterResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ElasticTrafficFilterResponse - :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 = 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.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ElasticTrafficFilterResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py deleted file mode 100644 index 0201c7b189cc..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py +++ /dev/null @@ -1,263 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_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 ..._utils.serialization import Deserializer, Serializer -from ...operations._monitor_operations import build_upgrade_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class MonitorOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`monitor` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _upgrade_initial( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorUpgrade, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ElasticMonitorUpgrade") - else: - _json = None - - _request = build_upgrade_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_upgrade( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.ElasticMonitorUpgrade] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic Monitor Upgrade Parameters. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_upgrade( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic Monitor Upgrade Parameters. 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: 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: - """ - - @distributed_trace_async - async def begin_upgrade( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorUpgrade, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic Monitor Upgrade Parameters. Is either a ElasticMonitorUpgrade type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade or IO[bytes] - :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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._upgrade_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py deleted file mode 100644 index b0024fef53f4..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py +++ /dev/null @@ -1,145 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._monitored_resources_operations import build_list_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class MonitoredResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`monitored_resources` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.MonitoredResource"]: - """List all resources currently being monitored by the Elastic monitor resource, helping you - manage observability. - - List all resources currently being monitored by the Elastic monitor resource, helping you - manage observability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either MonitoredResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.MonitoredResource] - :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.MonitoredResourceListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MonitoredResourceListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_subscriptions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_subscriptions_operations.py deleted file mode 100644 index ba955adfc483..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_subscriptions_operations.py +++ /dev/null @@ -1,794 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._monitored_subscriptions_operations import ( - build_createor_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class MonitoredSubscriptionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`monitored_subscriptions` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.MonitoredSubscriptionProperties"]: - """List all subscriptions currently being monitored by the Elastic monitor resource, helping you - manage observability. - - List all subscriptions currently being monitored by the Elastic monitor resource, helping you - manage observability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either MonitoredSubscriptionProperties or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :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.MonitoredSubscriptionPropertiesList] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MonitoredSubscriptionPropertiesList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, monitor_name: str, configuration_name: str, **kwargs: Any - ) -> _models.MonitoredSubscriptionProperties: - """Get detailed information about all subscriptions currently being monitored by the Elastic - monitor resource. - - Get detailed information about all subscriptions currently being monitored by the Elastic - monitor resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :return: MonitoredSubscriptionProperties or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties - :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 = 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.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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("MonitoredSubscriptionProperties", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _createor_update_initial( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[Union[_models.MonitoredSubscriptionProperties, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "MonitoredSubscriptionProperties") - else: - _json = None - - _request = build_createor_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_createor_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[_models.MonitoredSubscriptionProperties] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: - """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: Default value is None. - :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_createor_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: - """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: 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: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_createor_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[Union[_models.MonitoredSubscriptionProperties, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: - """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: Is either a MonitoredSubscriptionProperties type or a IO[bytes] type. Default - value is None. - :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.MonitoredSubscriptionProperties] = 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._createor_update_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoredSubscriptionProperties].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoredSubscriptionProperties]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[Union[_models.MonitoredSubscriptionProperties, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "MonitoredSubscriptionProperties") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = 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["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - 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, - monitor_name: str, - configuration_name: str, - body: Optional[_models.MonitoredSubscriptionProperties] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: - """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: Default value is None. - :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: - """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: 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: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[Union[_models.MonitoredSubscriptionProperties, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: - """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: Is either a MonitoredSubscriptionProperties type or a IO[bytes] type. Default - value is None. - :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.MonitoredSubscriptionProperties] = 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, - monitor_name=monitor_name, - configuration_name=configuration_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoredSubscriptionProperties].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoredSubscriptionProperties]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, monitor_name: str, configuration_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = 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["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - 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, monitor_name: str, configuration_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete subscriptions being monitored by the Elastic monitor resource, removing their - observability and monitoring capabilities. - - Delete subscriptions being monitored by the Elastic monitor resource, removing their - observability and monitoring capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - api_version=api_version, - 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 - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py deleted file mode 100644 index 0de168037826..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py +++ /dev/null @@ -1,841 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._monitors_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class MonitorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`monitors` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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) -> AsyncItemPaged["_models.ElasticMonitorResource"]: - """List all Elastic monitor resources within a specified subscription, helping you audit and - manage your monitoring setup. - - List all Elastic monitor resources within a specified subscription, helping you audit and - manage your monitoring setup. - - :return: An iterator like instance of either ElasticMonitorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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.ElasticMonitorResourceListResponse] = 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_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ElasticMonitorResourceListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ElasticMonitorResource"]: - """List all Elastic monitor resources within a specified resource group of the subscription, - helping you audit and manage your monitoring setup. - - List all Elastic monitor resources within a specified resource group of the subscription, - helping you audit and manage your monitoring setup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ElasticMonitorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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.ElasticMonitorResourceListResponse] = 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_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ElasticMonitorResourceListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.ElasticMonitorResource: - """Get detailed properties of a specific Elastic monitor resource, helping you manage - observability and performance. - - Get detailed properties of a specific Elastic monitor resource, helping you manage - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: ElasticMonitorResource or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ElasticMonitorResource - :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 = 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.ElasticMonitorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ElasticMonitorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorResource, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ElasticMonitorResource") - else: - _json = None - - _request = build_create_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.ElasticMonitorResource] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ElasticMonitorResource]: - """Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic monitor resource model. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ElasticMonitorResource or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ElasticMonitorResource]: - """Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic monitor resource 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: An instance of AsyncLROPoller that returns either ElasticMonitorResource or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorResource, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.ElasticMonitorResource]: - """Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic monitor resource model. Is either a ElasticMonitorResource type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ElasticMonitorResource or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.ElasticMonitorResource] = 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, - monitor_name=monitor_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("ElasticMonitorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ElasticMonitorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ElasticMonitorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorResourceUpdateParameters, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ElasticMonitorResourceUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = 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["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - 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, - monitor_name: str, - body: Optional[_models.ElasticMonitorResourceUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ElasticMonitorResource]: - """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic resource model update parameters. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ElasticMonitorResource or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ElasticMonitorResource]: - """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic resource model update parameters. 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: An instance of AsyncLROPoller that returns either ElasticMonitorResource or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorResourceUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.ElasticMonitorResource]: - """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic resource model update parameters. Is either a - ElasticMonitorResourceUpdateParameters type or a IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ElasticMonitorResource or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.ElasticMonitorResource] = 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, - monitor_name=monitor_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("ElasticMonitorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ElasticMonitorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ElasticMonitorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, monitor_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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, 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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete an existing Elastic monitor resource from your Azure subscription, removing its - observability and monitoring capabilities. - - Delete an existing Elastic monitor resource from your Azure subscription, removing its - observability and monitoring capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - api_version=api_version, - 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 - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_open_ai_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_open_ai_operations.py deleted file mode 100644 index 420d95e99641..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_open_ai_operations.py +++ /dev/null @@ -1,507 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._open_ai_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_status_request, - build_list_request, -) -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class OpenAIOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`open_ai` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.OpenAIIntegrationRPModel"]: - """List all OpenAI integration rules for a given Elastic monitor resource, helping you manage - AI-driven observability and monitoring. - - List all OpenAI integration rules for a given Elastic monitor resource, helping you manage - AI-driven observability and monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either OpenAIIntegrationRPModel or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] - :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.OpenAIIntegrationRPModelListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OpenAIIntegrationRPModelListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any - ) -> _models.OpenAIIntegrationRPModel: - """Get detailed information about OpenAI integration rules for a given Elastic monitor resource. - - Get detailed information about OpenAI integration rules for a given Elastic monitor resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :return: OpenAIIntegrationRPModel or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :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 = 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.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - integration_name=integration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - integration_name: str, - body: Optional[_models.OpenAIIntegrationRPModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.OpenAIIntegrationRPModel: - """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :param body: Default value is None. - :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: OpenAIIntegrationRPModel or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - integration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.OpenAIIntegrationRPModel: - """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :param body: 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: OpenAIIntegrationRPModel or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - integration_name: str, - body: Optional[Union[_models.OpenAIIntegrationRPModel, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.OpenAIIntegrationRPModel: - """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :param body: Is either a OpenAIIntegrationRPModel type or a IO[bytes] type. Default value is - None. - :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel or IO[bytes] - :return: OpenAIIntegrationRPModel or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[_models.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "OpenAIIntegrationRPModel") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - integration_name=integration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any) -> None: - """Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven - observability and monitoring capabilities. - - Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven - observability and monitoring capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :return: None or the result of cls(response) - :rtype: None - :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 = 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, - monitor_name=monitor_name, - integration_name=integration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_status( - self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any - ) -> _models.OpenAIIntegrationStatusResponse: - """Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal - observability and performance. - - Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :return: OpenAIIntegrationStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponse - :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 = 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.OpenAIIntegrationStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_status_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - integration_name=integration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenAIIntegrationStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py index c883ffda0cfd..6c5c5b4979b3 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py @@ -1,12 +1,15 @@ +# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -17,18 +20,68 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models as _models +from ... import models as _models, types as _types +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request -from .._configuration import MicrosoftElasticConfiguration +from ...operations._operations import ( + build_all_traffic_filters_list_request, + build_associate_traffic_filter_associate_request, + build_billing_info_get_request, + build_connected_partner_resources_list_request, + build_create_and_associate_ip_filter_create_request, + build_create_and_associate_pl_filter_create_request, + build_deployment_info_list_request, + build_detach_and_delete_traffic_filter_delete_request, + build_detach_traffic_filter_update_request, + build_elastic_versions_list_request, + build_external_user_create_or_update_request, + build_list_associated_traffic_filters_list_request, + build_monitor_upgrade_request, + build_monitored_resources_list_request, + build_monitored_subscriptions_createor_update_request, + build_monitored_subscriptions_delete_request, + build_monitored_subscriptions_get_request, + build_monitored_subscriptions_list_request, + build_monitored_subscriptions_update_request, + build_monitors_create_request, + build_monitors_delete_request, + build_monitors_get_request, + build_monitors_list_by_resource_group_request, + build_monitors_list_request, + build_monitors_update_request, + build_open_ai_create_or_update_request, + build_open_ai_delete_request, + build_open_ai_get_request, + build_open_ai_get_status_request, + build_open_ai_list_request, + build_operations_list_request, + build_organizations_get_api_key_request, + build_organizations_get_elastic_to_azure_subscription_mapping_request, + build_organizations_resubscribe_request, + build_tag_rules_create_or_update_request, + build_tag_rules_delete_request, + build_tag_rules_get_request, + build_tag_rules_list_request, + build_traffic_filters_delete_request, + build_upgradable_versions_details_request, + build_vm_collection_update_request, + build_vm_host_list_request, + build_vm_ingestion_details_request, +) +from .._configuration import ElasticMgmtClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] @@ -41,34 +94,884 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s :attr:`operations` attribute. """ - models = _models - 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: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ElasticMgmtClientConfiguration = 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) -> AsyncItemPaged["_models.OperationResult"]: - """List all operations provided by Microsoft.Elastic. + """List the operations for the provider. - List all operations provided by Microsoft.Elastic. - - :return: An iterator like instance of either OperationResult or the result of cls(response) + :return: An iterator like instance of OperationResult :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.OperationResult] :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.OperationResult]] = 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), + headers=_headers, + 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.OperationResult], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class MonitoredSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`monitored_subscriptions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> _models.MonitoredSubscriptionProperties: + """Get detailed information about all subscriptions currently being monitored by the Elastic + monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :return: MonitoredSubscriptionProperties. The MonitoredSubscriptionProperties is compatible + with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties + :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.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) + + _request = build_monitored_subscriptions_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MonitoredSubscriptionProperties, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _createor_update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[ + Union[_models.MonitoredSubscriptionProperties, _types.MonitoredSubscriptionProperties, IO[bytes]] + ] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitored_subscriptions_createor_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_models.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and + monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties + :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 MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_types.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and + monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.types.MonitoredSubscriptionProperties + :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 MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and + monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: 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: An instance of AsyncLROPoller that returns MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[ + Union[_models.MonitoredSubscriptionProperties, _types.MonitoredSubscriptionProperties, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and + monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Is either a MonitoredSubscriptionProperties type or a IO[bytes] type. Default + value is None. + :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties or + ~azure.mgmt.elastic.types.MonitoredSubscriptionProperties or IO[bytes] + :return: An instance of AsyncLROPoller that returns MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.MonitoredSubscriptionProperties] = 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._createor_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_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 = pipeline_response.http_response + deserialized = _deserialize(_models.MonitoredSubscriptionProperties, 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.MonitoredSubscriptionProperties].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MonitoredSubscriptionProperties]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[ + Union[_models.MonitoredSubscriptionProperties, _types.MonitoredSubscriptionProperties, IO[bytes]] + ] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitored_subscriptions_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + 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 _decompress else response.iter_raw() + + 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, + monitor_name: str, + configuration_name: str, + body: Optional[_models.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties + :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 MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_types.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.types.MonitoredSubscriptionProperties + :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 MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: 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: An instance of AsyncLROPoller that returns MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[ + Union[_models.MonitoredSubscriptionProperties, _types.MonitoredSubscriptionProperties, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Is either a MonitoredSubscriptionProperties type or a IO[bytes] type. Default + value is None. + :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties or + ~azure.mgmt.elastic.types.MonitoredSubscriptionProperties or IO[bytes] + :return: An instance of AsyncLROPoller that returns MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.MonitoredSubscriptionProperties] = 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, + monitor_name=monitor_name, + configuration_name=configuration_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 = pipeline_response.http_response + deserialized = _deserialize(_models.MonitoredSubscriptionProperties, 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.MonitoredSubscriptionProperties].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MonitoredSubscriptionProperties]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, monitor_name: str, configuration_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_monitored_subscriptions_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + 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 _decompress else response.iter_raw() + + 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, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete subscriptions being monitored by the Elastic monitor resource, removing their + observability and monitoring capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_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, + monitor_name=monitor_name, + configuration_name=configuration_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, monitor_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.MonitoredSubscriptionProperties"]: + """List all subscriptions currently being monitored by the Elastic monitor resource, helping you + manage observability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of MonitoredSubscriptionProperties + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :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.MonitoredSubscriptionProperties]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -81,12 +984,20 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OperationResult"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_monitored_subscriptions_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _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 @@ -99,18 +1010,4885 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.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.MonitoredSubscriptionProperties], + 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class TagRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`tag_rules` 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: ElasticMgmtClientConfiguration = 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, monitor_name: str, rule_set_name: str, **kwargs: Any + ) -> _models.MonitoringTagRules: + """Get detailed information about a tag rule set for a given Elastic monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param rule_set_name: Tag Rule Set resource name. Required. + :type rule_set_name: str + :return: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :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.MonitoringTagRules] = kwargs.pop("cls", None) + + _request = build_tag_rules_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MonitoringTagRules, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[_models.MonitoringTagRules] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MonitoringTagRules: + """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param rule_set_name: Required. + :type rule_set_name: str + :param body: request body of MonitoringTagRules. Default value is None. + :type body: ~azure.mgmt.elastic.models.MonitoringTagRules + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[_types.MonitoringTagRules] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MonitoringTagRules: + """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param rule_set_name: Required. + :type rule_set_name: str + :param body: request body of MonitoringTagRules. Default value is None. + :type body: ~azure.mgmt.elastic.types.MonitoringTagRules + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MonitoringTagRules: + """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param rule_set_name: Required. + :type rule_set_name: str + :param body: request body of MonitoringTagRules. 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: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[Union[_models.MonitoringTagRules, _types.MonitoringTagRules, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.MonitoringTagRules: + """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param rule_set_name: Required. + :type rule_set_name: str + :param body: request body of MonitoringTagRules. Is either a MonitoringTagRules type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.MonitoringTagRules or + ~azure.mgmt.elastic.types.MonitoringTagRules or IO[bytes] + :return: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :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)) + content_type = content_type if body else None + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_tag_rules_create_or_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MonitoringTagRules, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, monitor_name: str, rule_set_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_tag_rules_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_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) + + _decompress = kwargs.pop("decompress", True) + _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, 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.ResourceProviderDefaultErrorResponse, + response, + ) + 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 _decompress else response.iter_raw() + + 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, monitor_name: str, rule_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over + observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param rule_set_name: Tag Rule Set resource name. Required. + :type rule_set_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, + monitor_name=monitor_name, + rule_set_name=rule_set_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, monitor_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.MonitoringTagRules"]: + """List all tag rules for a given Elastic monitor resource, helping you manage fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of MonitoringTagRules + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.MonitoringTagRules] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MonitoringTagRules]] = 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_tag_rules_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.MonitoringTagRules], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class MonitorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`monitors` 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: ElasticMgmtClientConfiguration = 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, monitor_name: str, **kwargs: Any) -> _models.ElasticMonitorResource: + """Get detailed properties of a specific Elastic monitor resource, helping you manage + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: ElasticMonitorResource. The ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.ElasticMonitorResource + :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.ElasticMonitorResource] = kwargs.pop("cls", None) + + _request = build_monitors_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ElasticMonitorResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ElasticMonitorResource, _types.ElasticMonitorResource, IO[bytes]]] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitors_create_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + 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 _decompress else response.iter_raw() + + 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, + monitor_name: str, + body: Optional[_models.ElasticMonitorResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Create a new Elastic monitor resource in your Azure subscription, enabling observability and + monitoring of your Azure resources through Elastic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic monitor resource model. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ElasticMonitorResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Create a new Elastic monitor resource in your Azure subscription, enabling observability and + monitoring of your Azure resources through Elastic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic monitor resource model. Default value is None. + :type body: ~azure.mgmt.elastic.types.ElasticMonitorResource + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Create a new Elastic monitor resource in your Azure subscription, enabling observability and + monitoring of your Azure resources through Elastic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic monitor resource 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: An instance of AsyncLROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ElasticMonitorResource, _types.ElasticMonitorResource, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Create a new Elastic monitor resource in your Azure subscription, enabling observability and + monitoring of your Azure resources through Elastic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic monitor resource model. Is either a ElasticMonitorResource type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource or + ~azure.mgmt.elastic.types.ElasticMonitorResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.ElasticMonitorResource] = 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, + monitor_name=monitor_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 = pipeline_response.http_response + deserialized = _deserialize(_models.ElasticMonitorResource, 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.ElasticMonitorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ElasticMonitorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ + Union[ + _models.ElasticMonitorResourceUpdateParameters, _types.ElasticMonitorResourceUpdateParameters, IO[bytes] + ] + ] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitors_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + 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")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, + monitor_name: str, + body: Optional[_models.ElasticMonitorResourceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic resource model update parameters. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ElasticMonitorResourceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic resource model update parameters. Default value is None. + :type body: ~azure.mgmt.elastic.types.ElasticMonitorResourceUpdateParameters + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic resource model update parameters. 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: An instance of AsyncLROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ + Union[ + _models.ElasticMonitorResourceUpdateParameters, _types.ElasticMonitorResourceUpdateParameters, IO[bytes] + ] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic resource model update parameters. Is either a + ElasticMonitorResourceUpdateParameters type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters or + ~azure.mgmt.elastic.types.ElasticMonitorResourceUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.ElasticMonitorResource] = 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, + monitor_name=monitor_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 = pipeline_response.http_response + deserialized = _deserialize(_models.ElasticMonitorResource, 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.ElasticMonitorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ElasticMonitorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, monitor_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_monitors_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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, 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.ResourceProviderDefaultErrorResponse, + response, + ) + 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 _decompress else response.iter_raw() + + 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, monitor_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete an existing Elastic monitor resource from your Azure subscription, removing its + observability and monitoring capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_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, + monitor_name=monitor_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_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ElasticMonitorResource"]: + """List all Elastic monitor resources within a specified resource group of the subscription, + helping you audit and manage your monitoring setup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of ElasticMonitorResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ElasticMonitorResource]] = 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_monitors_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + 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.ElasticMonitorResource], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ElasticMonitorResource"]: + """List all Elastic monitor resources within a specified subscription, helping you audit and + manage your monitoring setup. + + :return: An iterator like instance of ElasticMonitorResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ElasticMonitorResource]] = 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_monitors_list_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), + headers=_headers, + 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.ElasticMonitorResource], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class MonitoredResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`monitored_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: ElasticMgmtClientConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.MonitoredResource"]: + """List all resources currently being monitored by the Elastic monitor resource, helping you + manage observability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of MonitoredResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.MonitoredResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MonitoredResource]] = 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_monitored_resources_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.MonitoredResource], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DeploymentInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`deployment_info` 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: ElasticMgmtClientConfiguration = 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 list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.DeploymentInfoResponse: + """Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: DeploymentInfoResponse. The DeploymentInfoResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.DeploymentInfoResponse + :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.DeploymentInfoResponse] = kwargs.pop("cls", None) + + _request = build_deployment_info_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DeploymentInfoResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExternalUserOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`external_user` 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: ElasticMgmtClientConfiguration = 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 create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.ExternalUserInfo] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExternalUserCreationResponse: + """Create or update external user configurations for your Elastic monitor resource, enabling + access and management by external users. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic External User Creation Parameters. Default value is None. + :type body: ~azure.mgmt.elastic.models.ExternalUserInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ExternalUserCreationResponse. The ExternalUserCreationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ExternalUserInfo] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExternalUserCreationResponse: + """Create or update external user configurations for your Elastic monitor resource, enabling + access and management by external users. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic External User Creation Parameters. Default value is None. + :type body: ~azure.mgmt.elastic.types.ExternalUserInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ExternalUserCreationResponse. The ExternalUserCreationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExternalUserCreationResponse: + """Create or update external user configurations for your Elastic monitor resource, enabling + access and management by external users. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic External User Creation Parameters. 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: ExternalUserCreationResponse. The ExternalUserCreationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ExternalUserInfo, _types.ExternalUserInfo, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ExternalUserCreationResponse: + """Create or update external user configurations for your Elastic monitor resource, enabling + access and management by external users. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic External User Creation Parameters. Is either a ExternalUserInfo type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ExternalUserInfo or + ~azure.mgmt.elastic.types.ExternalUserInfo or IO[bytes] + :return: ExternalUserCreationResponse. The ExternalUserCreationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse + :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)) + content_type = content_type if body else None + cls: ClsType[_models.ExternalUserCreationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_external_user_create_or_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ExternalUserCreationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BillingInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`billing_info` 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: ElasticMgmtClientConfiguration = 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, monitor_name: str, **kwargs: Any) -> _models.BillingInfoResponse: + """Retrieve marketplace and organization billing information mapped to the given Elastic monitor + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: BillingInfoResponse. The BillingInfoResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.BillingInfoResponse + :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.BillingInfoResponse] = kwargs.pop("cls", None) + + _request = build_billing_info_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.BillingInfoResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ConnectedPartnerResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`connected_partner_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: ElasticMgmtClientConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ConnectedPartnerResourcesListFormat"]: + """List all active deployments associated with the marketplace subscription linked to the given + Elastic monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of ConnectedPartnerResourcesListFormat + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConnectedPartnerResourcesListFormat]] = 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_connected_partner_resources_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.ConnectedPartnerResourcesListFormat], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VMHostOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`vm_host` 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: ElasticMgmtClientConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> AsyncItemPaged["_models.VMResources"]: + """List all VM resources currently being monitored by the Elastic monitor resource, helping you + manage observability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of VMResources + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.VMResources] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VMResources]] = 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_vm_host_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.VMResources], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VMIngestionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`vm_ingestion` 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: ElasticMgmtClientConfiguration = 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 details( + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> _models.VMIngestionDetailsResponse: + """List detailed information about VM ingestion that will be monitored by the Elastic monitor + resource, ensuring optimal observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: VMIngestionDetailsResponse. The VMIngestionDetailsResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.VMIngestionDetailsResponse + :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.VMIngestionDetailsResponse] = kwargs.pop("cls", None) + + _request = build_vm_ingestion_details_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VMIngestionDetailsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VMCollectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`vm_collection` 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: ElasticMgmtClientConfiguration = 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 update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.VMCollectionUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: VM resource Id. Default value is None. + :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.VMCollectionUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: VM resource Id. Default value is None. + :type body: ~azure.mgmt.elastic.types.VMCollectionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: VM resource Id. 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: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.VMCollectionUpdate, _types.VMCollectionUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: VM resource Id. Is either a VMCollectionUpdate type or a IO[bytes] type. Default + value is None. + :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate or + ~azure.mgmt.elastic.types.VMCollectionUpdate or IO[bytes] + :return: None + :rtype: None + :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)) + content_type = content_type if body else None + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_vm_collection_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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 = 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class UpgradableVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`upgradable_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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 details( + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> _models.UpgradableVersionsList: + """List all upgradable versions for your Elastic monitor resource, helping you plan and execute + upgrades. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: UpgradableVersionsList. The UpgradableVersionsList is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UpgradableVersionsList + :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.UpgradableVersionsList] = kwargs.pop("cls", None) + + _request = build_upgradable_versions_details_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.UpgradableVersionsList, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class MonitorOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`monitor` 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: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _upgrade_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ElasticMonitorUpgrade, _types.ElasticMonitorUpgrade, IO[bytes]]] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitor_upgrade_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.ElasticMonitorUpgrade] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and + performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic Monitor Upgrade Parameters. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ElasticMonitorUpgrade] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and + performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic Monitor Upgrade Parameters. Default value is None. + :type body: ~azure.mgmt.elastic.types.ElasticMonitorUpgrade + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and + performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic Monitor Upgrade Parameters. 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: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ElasticMonitorUpgrade, _types.ElasticMonitorUpgrade, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and + performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic Monitor Upgrade Parameters. Is either a ElasticMonitorUpgrade type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade or + ~azure.mgmt.elastic.types.ElasticMonitorUpgrade or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._upgrade_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_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): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class AllTrafficFiltersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`all_traffic_filters` 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: ElasticMgmtClientConfiguration = 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 list( + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> _models.ElasticTrafficFilterResponse: + """List all traffic filters associated with your Elastic monitor resource, helping you manage + network traffic control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: ElasticTrafficFilterResponse. The ElasticTrafficFilterResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ElasticTrafficFilterResponse + :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.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) + + _request = build_all_traffic_filters_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ElasticTrafficFilterResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class listAssociatedTrafficFiltersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`list_associated_traffic_filters` 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: ElasticMgmtClientConfiguration = 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 list( + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> _models.ElasticTrafficFilterResponse: + """List all traffic filters associated with your Elastic monitor resource, helping you manage + network traffic control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: ElasticTrafficFilterResponse. The ElasticTrafficFilterResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ElasticTrafficFilterResponse + :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.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) + + _request = build_list_associated_traffic_filters_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ElasticTrafficFilterResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class createAndAssociateIPFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`create_and_associate_ip_filter` 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: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + *, + ips: Optional[str] = None, + name: Optional[str] = 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_create_and_associate_ip_filter_create_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ips=ips, + name=name, + 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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + ips: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create and associate an IP filter with your Elastic monitor resource to control and manage + network traffic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ips: List of ips. Default value is None. + :paramtype ips: str + :keyword name: Name of the traffic filter. Default value is None. + :paramtype 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._create_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + ips=ips, + name=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 + + +class createAndAssociatePLFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`create_and_associate_pl_filter` 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: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + *, + name: Optional[str] = None, + private_endpoint_guid: Optional[str] = None, + private_endpoint_name: Optional[str] = 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_create_and_associate_pl_filter_create_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + name=name, + private_endpoint_guid=private_endpoint_guid, + private_endpoint_name=private_endpoint_name, + 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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + name: Optional[str] = None, + private_endpoint_guid: Optional[str] = None, + private_endpoint_name: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create and associate a PL filter with your Elastic monitor resource to control and manage + network traffic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword name: Name of the traffic filter. Default value is None. + :paramtype name: str + :keyword private_endpoint_guid: Guid of the private endpoint. Default value is None. + :paramtype private_endpoint_guid: str + :keyword private_endpoint_name: Name of the private endpoint. Default value is None. + :paramtype private_endpoint_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._create_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + name=name, + private_endpoint_guid=private_endpoint_guid, + private_endpoint_name=private_endpoint_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 + + +class AssociateTrafficFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`associate_traffic_filter` 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: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _associate_initial( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = 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_associate_traffic_filter_associate_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ruleset_id=ruleset_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) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_associate( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Associate a traffic filter with your Elastic monitor resource to control and manage network + traffic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ruleset_id: Ruleset Id of the filter. Default value is None. + :paramtype ruleset_id: 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._associate_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + ruleset_id=ruleset_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class DetachAndDeleteTrafficFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`detach_and_delete_traffic_filter` 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: ElasticMgmtClientConfiguration = 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 delete( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = None, **kwargs: Any + ) -> None: + """Detach and delete an existing traffic filter from your Elastic monitor resource, removing its + network traffic control capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ruleset_id: Ruleset Id of the filter. Default value is None. + :paramtype ruleset_id: str + :return: None + :rtype: None + :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[None] = kwargs.pop("cls", None) + + _request = build_detach_and_delete_traffic_filter_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ruleset_id=ruleset_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 = 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class DetachTrafficFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`detach_traffic_filter` 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: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _update_initial( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = 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_detach_traffic_filter_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ruleset_id=ruleset_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) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Detach an existing traffic filter from your Elastic monitor resource, removing its network + traffic control capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ruleset_id: Ruleset Id of the filter. Default value is None. + :paramtype ruleset_id: 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._update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + ruleset_id=ruleset_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class TrafficFiltersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`traffic_filters` 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: ElasticMgmtClientConfiguration = 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 delete( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = None, **kwargs: Any + ) -> None: + """Delete an existing traffic filter associated with your Elastic monitor resource, removing its + network traffic control capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ruleset_id: Ruleset Id of the filter. Default value is None. + :paramtype ruleset_id: str + :return: None + :rtype: None + :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[None] = kwargs.pop("cls", None) + + _request = build_traffic_filters_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ruleset_id=ruleset_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 = 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class OrganizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`organizations` 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: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _resubscribe_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ResubscribeProperties, _types.ResubscribeProperties, IO[bytes]]] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_organizations_resubscribe_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.ResubscribeProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Resubscribe the Elasticsearch Organization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Resubscribe Properties. Default value is None. + :type body: ~azure.mgmt.elastic.models.ResubscribeProperties + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ResubscribeProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Resubscribe the Elasticsearch Organization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Resubscribe Properties. Default value is None. + :type body: ~azure.mgmt.elastic.types.ResubscribeProperties + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Resubscribe the Elasticsearch Organization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Resubscribe Properties. 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: An instance of AsyncLROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ResubscribeProperties, _types.ResubscribeProperties, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ElasticMonitorResource]: + """Resubscribe the Elasticsearch Organization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Resubscribe Properties. Is either a ResubscribeProperties type or a IO[bytes] + type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ResubscribeProperties or + ~azure.mgmt.elastic.types.ResubscribeProperties or IO[bytes] + :return: An instance of AsyncLROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.ElasticMonitorResource] = 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._resubscribe_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_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 = pipeline_response.http_response + deserialized = _deserialize(_models.ElasticMonitorResource, 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.ElasticMonitorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ElasticMonitorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def get_api_key( + self, body: Optional[_models.UserEmailId] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + :param body: The request body. Default value is None. + :type body: ~azure.mgmt.elastic.models.UserEmailId + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UserApiKeyResponse. The UserApiKeyResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_api_key( + self, body: Optional[_types.UserEmailId] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + :param body: The request body. Default value is None. + :type body: ~azure.mgmt.elastic.types.UserEmailId + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UserApiKeyResponse. The UserApiKeyResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_api_key( + self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + :param body: The request body. 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: UserApiKeyResponse. The UserApiKeyResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_api_key( + self, body: Optional[Union[_models.UserEmailId, _types.UserEmailId, IO[bytes]]] = None, **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + :param body: The request body. Is either a UserEmailId type or a IO[bytes] type. Default value + is None. + :type body: ~azure.mgmt.elastic.models.UserEmailId or ~azure.mgmt.elastic.types.UserEmailId or + IO[bytes] + :return: UserApiKeyResponse. The UserApiKeyResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :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)) + content_type = content_type if body else None + cls: ClsType[_models.UserApiKeyResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_organizations_get_api_key_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.UserApiKeyResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_elastic_to_azure_subscription_mapping( # pylint: disable=name-too-long + self, **kwargs: Any + ) -> _models.ElasticOrganizationToAzureSubscriptionMappingResponse: + """Retrieve mapping details between the Elastic Organization and Azure Subscription for the + logged-in user. + + ; + /** + Retrieve mapping details between the Elastic Organization and Azure Subscription for the + logged-in user. + + . + + :return: ElasticOrganizationToAzureSubscriptionMappingResponse. The + ElasticOrganizationToAzureSubscriptionMappingResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse + :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.ElasticOrganizationToAzureSubscriptionMappingResponse] = kwargs.pop("cls", None) + + _request = build_organizations_get_elastic_to_azure_subscription_mapping_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ElasticOrganizationToAzureSubscriptionMappingResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OpenAIOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`open_ai` 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: ElasticMgmtClientConfiguration = 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, monitor_name: str, integration_name: str, **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Get detailed information about OpenAI integration rules for a given Elastic monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :return: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :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.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) + + _request = build_open_ai_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OpenAIIntegrationRPModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[_models.OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling + advanced AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param integration_name: Required. + :type integration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[_types.OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling + advanced AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param integration_name: Required. + :type integration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.types.OpenAIIntegrationRPModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling + advanced AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param integration_name: Required. + :type integration_name: str + :param body: 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: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[Union[_models.OpenAIIntegrationRPModel, _types.OpenAIIntegrationRPModel, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling + advanced AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param integration_name: Required. + :type integration_name: str + :param body: Is either a OpenAIIntegrationRPModel type or a IO[bytes] type. Default value is + None. + :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel or + ~azure.mgmt.elastic.types.OpenAIIntegrationRPModel or IO[bytes] + :return: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :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)) + content_type = content_type if body else None + cls: ClsType[_models.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_open_ai_create_or_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OpenAIIntegrationRPModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any) -> None: + """Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven + observability and monitoring capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :return: None + :rtype: None + :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[None] = kwargs.pop("cls", None) + + _request = build_open_ai_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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 = 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.OpenAIIntegrationRPModel"]: + """List all OpenAI integration rules for a given Elastic monitor resource, helping you manage + AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of OpenAIIntegrationRPModel + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OpenAIIntegrationRPModel]] = 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_open_ai_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.OpenAIIntegrationRPModel], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_status( + self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any + ) -> _models.OpenAIIntegrationStatusResponse: + """Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :return: OpenAIIntegrationStatusResponse. The OpenAIIntegrationStatusResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponse + :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.OpenAIIntegrationStatusResponse] = kwargs.pop("cls", None) + + _request = build_open_ai_get_status_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OpenAIIntegrationStatusResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ElasticVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.ElasticMgmtClient`'s + :attr:`elastic_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, *, region: str, **kwargs: Any) -> AsyncItemPaged["_models.ElasticVersionListFormat"]: + """Retrieve a list of all available Elastic versions for a specified region, helping you choose + the best version for your deployment. + + Retrieve a list of all available Elastic versions for a specified region, helping you choose + the best version for your deployment. + + :keyword region: Region where elastic deployment will take place. Required. + :paramtype region: str + :return: An iterator like instance of ElasticVersionListFormat + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticVersionListFormat] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ElasticVersionListFormat]] = 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_elastic_versions_list_request( + subscription_id=self._config.subscription_id, + region=region, + 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), + headers=_headers, + 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.ElasticVersionListFormat], + 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) @@ -123,8 +5901,9 @@ async def get_next(next_link=None): 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.ResourceProviderDefaultErrorResponse, pipeline_response + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py deleted file mode 100644 index 375cd72ca71b..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py +++ /dev/null @@ -1,449 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_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 ..._utils.serialization import Deserializer, Serializer -from ...operations._organizations_operations import ( - build_get_api_key_request, - build_get_elastic_to_azure_subscription_mapping_request, - build_resubscribe_request, -) -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class OrganizationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`organizations` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 get_api_key( - self, body: Optional[_models.UserEmailId] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UserApiKeyResponse: - """Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - :param body: Email Id parameter of the User Organization, of which the API Key must be - returned. Default value is None. - :type body: ~azure.mgmt.elastic.models.UserEmailId - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UserApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def get_api_key( - self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UserApiKeyResponse: - """Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - :param body: Email Id parameter of the User Organization, of which the API Key must be - returned. 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: UserApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def get_api_key( - self, body: Optional[Union[_models.UserEmailId, IO[bytes]]] = None, **kwargs: Any - ) -> _models.UserApiKeyResponse: - """Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - :param body: Email Id parameter of the User Organization, of which the API Key must be - returned. Is either a UserEmailId type or a IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.UserEmailId or IO[bytes] - :return: UserApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[_models.UserApiKeyResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UserEmailId") - else: - _json = None - - _request = build_get_api_key_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UserApiKeyResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_elastic_to_azure_subscription_mapping( # pylint: disable=name-too-long - self, **kwargs: Any - ) -> _models.ElasticOrganizationToAzureSubscriptionMappingResponse: - """Retrieve mapping details between the Elastic Organization and Azure Subscription for the - logged-in user. - - Retrieve mapping details between the Elastic Organization and Azure Subscription for the - logged-in user. - - :return: ElasticOrganizationToAzureSubscriptionMappingResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse - :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 = 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.ElasticOrganizationToAzureSubscriptionMappingResponse] = kwargs.pop("cls", None) - - _request = build_get_elastic_to_azure_subscription_mapping_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ElasticOrganizationToAzureSubscriptionMappingResponse", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _resubscribe_initial( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ResubscribeProperties, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ResubscribeProperties") - else: - _json = None - - _request = build_resubscribe_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = 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["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_resubscribe( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.ResubscribeProperties] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ElasticMonitorResource]: - """Resubscribe the Elasticsearch Organization. - - Resubscribe the Elasticsearch Organization. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Resubscribe Properties. Default value is None. - :type body: ~azure.mgmt.elastic.models.ResubscribeProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ElasticMonitorResource or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_resubscribe( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ElasticMonitorResource]: - """Resubscribe the Elasticsearch Organization. - - Resubscribe the Elasticsearch Organization. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Resubscribe Properties. 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: An instance of AsyncLROPoller that returns either ElasticMonitorResource or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_resubscribe( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ResubscribeProperties, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.ElasticMonitorResource]: - """Resubscribe the Elasticsearch Organization. - - Resubscribe the Elasticsearch Organization. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Resubscribe Properties. Is either a ResubscribeProperties type or a IO[bytes] - type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ResubscribeProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ElasticMonitorResource or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.ElasticMonitorResource] = 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._resubscribe_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("ElasticMonitorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ElasticMonitorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ElasticMonitorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_patch.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_patch.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# 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 """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py deleted file mode 100644 index b74e3b722629..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py +++ /dev/null @@ -1,496 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._tag_rules_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class TagRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`tag_rules` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.MonitoringTagRules"]: - """List all tag rules for a given Elastic monitor resource, helping you manage fine-grained - control over observability based on resource tags. - - List all tag rules for a given Elastic monitor resource, helping you manage fine-grained - control over observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either MonitoringTagRules or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.MonitoringTagRules] - :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.MonitoringTagRulesListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MonitoringTagRulesListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - async def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - rule_set_name: str, - body: Optional[_models.MonitoringTagRules] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MonitoringTagRules: - """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :param body: request body of MonitoringTagRules. Default value is None. - :type body: ~azure.mgmt.elastic.models.MonitoringTagRules - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MonitoringTagRules or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - rule_set_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MonitoringTagRules: - """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :param body: request body of MonitoringTagRules. 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: MonitoringTagRules or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - rule_set_name: str, - body: Optional[Union[_models.MonitoringTagRules, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.MonitoringTagRules: - """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :param body: request body of MonitoringTagRules. Is either a MonitoringTagRules type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.MonitoringTagRules or IO[bytes] - :return: MonitoringTagRules or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "MonitoringTagRules") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MonitoringTagRules", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, monitor_name: str, rule_set_name: str, **kwargs: Any - ) -> _models.MonitoringTagRules: - """Get detailed information about a tag rule set for a given Elastic monitor resource. - - Get detailed information about a tag rule set for a given Elastic monitor resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :return: MonitoringTagRules or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules - :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 = 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.MonitoringTagRules] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MonitoringTagRules", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, monitor_name: str, rule_set_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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, 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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, monitor_name: str, rule_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over - observability based on resource tags. - - Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over - observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - api_version=api_version, - 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 - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py deleted file mode 100644 index a63d4ffcbbfa..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py +++ /dev/null @@ -1,116 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._traffic_filters_operations import build_delete_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class TrafficFiltersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`traffic_filters` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 delete( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = None, **kwargs: Any - ) -> None: - """Delete an existing traffic filter associated with your Elastic monitor resource, removing its - network traffic control capabilities. - - Delete an existing traffic filter associated with your Elastic monitor resource, removing its - network traffic control capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ruleset_id: Ruleset Id of the filter. Default value is None. - :type ruleset_id: str - :return: None or the result of cls(response) - :rtype: None - :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 = 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, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ruleset_id=ruleset_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py deleted file mode 100644 index 72f1757fe2eb..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py +++ /dev/null @@ -1,117 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._upgradable_versions_operations import build_details_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class UpgradableVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`upgradable_versions` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 details( - self, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> _models.UpgradableVersionsList: - """List all upgradable versions for your Elastic monitor resource, helping you plan and execute - upgrades. - - List all upgradable versions for your Elastic monitor resource, helping you plan and execute - upgrades. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: UpgradableVersionsList or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.UpgradableVersionsList - :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 = 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.UpgradableVersionsList] = kwargs.pop("cls", None) - - _request = build_details_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpgradableVersionsList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py deleted file mode 100644 index 98a08d4898a3..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py +++ /dev/null @@ -1,199 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._vm_collection_operations import build_update_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VMCollectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`vm_collection` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.VMCollectionUpdate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: VM resource Id. Default value is None. - :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: VM resource Id. 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: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.VMCollectionUpdate, IO[bytes]]] = None, - **kwargs: Any - ) -> None: - """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: VM resource Id. Is either a VMCollectionUpdate type or a IO[bytes] type. Default - value is None. - :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate or IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "VMCollectionUpdate") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py deleted file mode 100644 index 4527ee157e42..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py +++ /dev/null @@ -1,143 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._vm_host_operations import build_list_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VMHostOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`vm_host` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> AsyncItemPaged["_models.VMResources"]: - """List all VM resources currently being monitored by the Elastic monitor resource, helping you - manage observability. - - List all VM resources currently being monitored by the Elastic monitor resource, helping you - manage observability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either VMResources or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.VMResources] - :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.VMHostListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VMHostListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py deleted file mode 100644 index 8dca0392fe8e..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py +++ /dev/null @@ -1,117 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._vm_ingestion_operations import build_details_request -from .._configuration import MicrosoftElasticConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VMIngestionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s - :attr:`vm_ingestion` attribute. - """ - - models = _models - - 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: MicrosoftElasticConfiguration = 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 details( - self, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> _models.VMIngestionDetailsResponse: - """List detailed information about VM ingestion that will be monitored by the Elastic monitor - resource, ensuring optimal observability and performance. - - List detailed information about VM ingestion that will be monitored by the Elastic monitor - resource, ensuring optimal observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: VMIngestionDetailsResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.VMIngestionDetailsResponse - :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 = 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.VMIngestionDetailsResponse] = kwargs.pop("cls", None) - - _request = build_details_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VMIngestionDetailsResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py index fe7f8f216b95..7f7baa1697b4 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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 @@ -13,17 +13,15 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore BillingInfoResponse, CompanyInfo, ConnectedPartnerResourceProperties, ConnectedPartnerResourcesListFormat, - ConnectedPartnerResourcesListResponse, DeploymentInfoResponse, ElasticCloudDeployment, ElasticCloudUser, ElasticMonitorResource, - ElasticMonitorResourceListResponse, ElasticMonitorResourceUpdateParameters, ElasticMonitorUpgrade, ElasticOrganizationToAzureSubscriptionMappingResponse, @@ -34,7 +32,6 @@ ElasticTrafficFilterRule, ElasticVersionListFormat, ElasticVersionListProperties, - ElasticVersionsListResponse, ErrorAdditionalInfo, ErrorDetail, ErrorResponse, @@ -48,41 +45,38 @@ MarketplaceSaaSInfoMarketplaceSubscription, MonitorProperties, MonitoredResource, - MonitoredResourceListResponse, MonitoredSubscription, MonitoredSubscriptionProperties, - MonitoredSubscriptionPropertiesList, MonitoringTagRules, - MonitoringTagRulesListResponse, MonitoringTagRulesProperties, OpenAIIntegrationProperties, OpenAIIntegrationRPModel, - OpenAIIntegrationRPModelListResponse, OpenAIIntegrationStatusResponse, OpenAIIntegrationStatusResponseProperties, OperationDisplay, - OperationListResult, OperationResult, PartnerBillingEntity, PlanDetails, ProjectDetails, + ProxyResource, + Resource, ResourceProviderDefaultErrorResponse, ResourceSku, ResubscribeProperties, SubscriptionList, SystemData, + TrackedResource, UpgradableVersionsList, UserApiKeyResponse, UserApiKeyResponseProperties, UserEmailId, UserInfo, VMCollectionUpdate, - VMHostListResponse, VMIngestionDetailsResponse, VMResources, ) -from ._microsoft_elastic_enums import ( # type: ignore +from ._enums import ( # type: ignore ConfigurationType, CreatedByType, ElasticDeploymentStatus, @@ -108,12 +102,10 @@ "CompanyInfo", "ConnectedPartnerResourceProperties", "ConnectedPartnerResourcesListFormat", - "ConnectedPartnerResourcesListResponse", "DeploymentInfoResponse", "ElasticCloudDeployment", "ElasticCloudUser", "ElasticMonitorResource", - "ElasticMonitorResourceListResponse", "ElasticMonitorResourceUpdateParameters", "ElasticMonitorUpgrade", "ElasticOrganizationToAzureSubscriptionMappingResponse", @@ -124,7 +116,6 @@ "ElasticTrafficFilterRule", "ElasticVersionListFormat", "ElasticVersionListProperties", - "ElasticVersionsListResponse", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -138,36 +129,33 @@ "MarketplaceSaaSInfoMarketplaceSubscription", "MonitorProperties", "MonitoredResource", - "MonitoredResourceListResponse", "MonitoredSubscription", "MonitoredSubscriptionProperties", - "MonitoredSubscriptionPropertiesList", "MonitoringTagRules", - "MonitoringTagRulesListResponse", "MonitoringTagRulesProperties", "OpenAIIntegrationProperties", "OpenAIIntegrationRPModel", - "OpenAIIntegrationRPModelListResponse", "OpenAIIntegrationStatusResponse", "OpenAIIntegrationStatusResponseProperties", "OperationDisplay", - "OperationListResult", "OperationResult", "PartnerBillingEntity", "PlanDetails", "ProjectDetails", + "ProxyResource", + "Resource", "ResourceProviderDefaultErrorResponse", "ResourceSku", "ResubscribeProperties", "SubscriptionList", "SystemData", + "TrackedResource", "UpgradableVersionsList", "UserApiKeyResponse", "UserApiKeyResponseProperties", "UserEmailId", "UserInfo", "VMCollectionUpdate", - "VMHostListResponse", "VMIngestionDetailsResponse", "VMResources", "ConfigurationType", diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_enums.py similarity index 74% rename from sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py rename to sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_enums.py index a6fe9b98cff7..9243bd70fc74 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- @@ -14,119 +14,166 @@ class ConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Configuration type of the Elasticsearch project.""" GENERAL_PURPOSE = "GeneralPurpose" + """GENERAL_PURPOSE.""" VECTOR = "Vector" + """VECTOR.""" TIME_SERIES = "TimeSeries" + """TIME_SERIES.""" NOT_APPLICABLE = "NotApplicable" + """NOT_APPLICABLE.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """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 ElasticDeploymentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Flag specifying if the Elastic deployment status is healthy or not.""" HEALTHY = "Healthy" + """HEALTHY.""" UNHEALTHY = "Unhealthy" + """UNHEALTHY.""" class HostingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Hosting type of the monitor resource - either Hosted deployments or Serverless Projects.""" HOSTED = "Hosted" + """HOSTED.""" SERVERLESS = "Serverless" + """SERVERLESS.""" class LiftrResourceCategories(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """LiftrResourceCategories.""" + """Type of LiftrResourceCategories.""" UNKNOWN = "Unknown" + """UNKNOWN.""" MONITOR_LOGS = "MonitorLogs" + """MONITOR_LOGS.""" class ManagedIdentityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Managed Identity types.""" SYSTEM_ASSIGNED = "SystemAssigned" + """SYSTEM_ASSIGNED.""" class MonitoringStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Flag specifying if the resource monitoring is enabled or disabled.""" ENABLED = "Enabled" + """ENABLED.""" DISABLED = "Disabled" + """DISABLED.""" class Operation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation for the patch on the resource.""" ADD_BEGIN = "AddBegin" + """ADD_BEGIN.""" ADD_COMPLETE = "AddComplete" + """ADD_COMPLETE.""" DELETE_BEGIN = "DeleteBegin" + """DELETE_BEGIN.""" DELETE_COMPLETE = "DeleteComplete" + """DELETE_COMPLETE.""" ACTIVE = "Active" + """ACTIVE.""" class OperationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Operation to be performed on the given vm resource id.""" ADD = "Add" + """ADD.""" DELETE = "Delete" + """DELETE.""" class ProjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Project type; ex: Elasticsearch / Observability / Security.""" ELASTICSEARCH = "Elasticsearch" + """ELASTICSEARCH.""" OBSERVABILITY = "Observability" + """OBSERVABILITY.""" SECURITY = "Security" + """SECURITY.""" NOT_APPLICABLE = "NotApplicable" + """NOT_APPLICABLE.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of Elastic resource.""" ACCEPTED = "Accepted" + """ACCEPTED.""" CREATING = "Creating" + """CREATING.""" UPDATING = "Updating" + """UPDATING.""" DELETING = "Deleting" + """DELETING.""" SUCCEEDED = "Succeeded" + """SUCCEEDED.""" FAILED = "Failed" + """FAILED.""" CANCELED = "Canceled" + """CANCELED.""" DELETED = "Deleted" + """DELETED.""" NOT_SPECIFIED = "NotSpecified" + """NOT_SPECIFIED.""" class SendingLogs(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Flag indicating the status of the resource for sending logs operation to Elastic.""" TRUE = "True" + """TRUE.""" FALSE = "False" + """FALSE.""" class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The state of monitoring.""" IN_PROGRESS = "InProgress" + """IN_PROGRESS.""" ACTIVE = "Active" + """ACTIVE.""" FAILED = "Failed" + """FAILED.""" DELETING = "Deleting" + """DELETING.""" class TagAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Valid actions for a filtering tag. Exclusion takes priority over inclusion.""" INCLUDE = "Include" + """INCLUDE.""" EXCLUDE = "Exclude" + """EXCLUDE.""" class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the elastic filter.""" IP = "ip" + """IP.""" AZURE_PRIVATE_ENDPOINT = "azure_private_endpoint" + """AZURE_PRIVATE_ENDPOINT.""" diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models.py new file mode 100644 index 000000000000..75cef846610e --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models.py @@ -0,0 +1,2459 @@ +# 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, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class BillingInfoResponse(_Model): + """Marketplace Subscription and Organization details to which resource gets billed into. + + :ivar marketplace_saas_info: Marketplace Subscription details. + :vartype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo + :ivar partner_billing_entity: Partner Billing Entity details: Organization Info. + :vartype partner_billing_entity: ~azure.mgmt.elastic.models.PartnerBillingEntity + """ + + marketplace_saas_info: Optional["_models.MarketplaceSaaSInfo"] = rest_field( + name="marketplaceSaasInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Marketplace Subscription details.""" + partner_billing_entity: Optional["_models.PartnerBillingEntity"] = rest_field( + name="partnerBillingEntity", visibility=["read", "create", "update", "delete", "query"] + ) + """Partner Billing Entity details: Organization Info.""" + + @overload + def __init__( + self, + *, + marketplace_saas_info: Optional["_models.MarketplaceSaaSInfo"] = None, + partner_billing_entity: Optional["_models.PartnerBillingEntity"] = 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 CompanyInfo(_Model): + """Company information of the user to be passed to partners. + + :ivar domain: Domain of the company. + :vartype domain: str + :ivar business: Business of the company. + :vartype business: str + :ivar employees_number: Number of employees in the company. + :vartype employees_number: str + :ivar state: State of the company location. + :vartype state: str + :ivar country: Country of the company location. + :vartype country: str + """ + + domain: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Domain of the company.""" + business: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Business of the company.""" + employees_number: Optional[str] = rest_field( + name="employeesNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of employees in the company.""" + state: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """State of the company location.""" + country: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Country of the company location.""" + + @overload + def __init__( + self, + *, + domain: Optional[str] = None, + business: Optional[str] = None, + employees_number: Optional[str] = None, + state: Optional[str] = None, + country: 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 ConnectedPartnerResourceProperties(_Model): + """Connected Partner Resource Properties. + + :ivar partner_deployment_name: Elastic resource name. + :vartype partner_deployment_name: str + :ivar partner_deployment_uri: URL of the resource in Elastic cloud. + :vartype partner_deployment_uri: str + :ivar azure_resource_id: The azure resource Id of the resource. + :vartype azure_resource_id: str + :ivar location: The location of the resource. + :vartype location: str + :ivar type: The hosting type of the resource. + :vartype type: str + """ + + partner_deployment_name: Optional[str] = rest_field( + name="partnerDeploymentName", visibility=["read", "create", "update", "delete", "query"] + ) + """Elastic resource name.""" + partner_deployment_uri: Optional[str] = rest_field( + name="partnerDeploymentUri", visibility=["read", "create", "update", "delete", "query"] + ) + """URL of the resource in Elastic cloud.""" + azure_resource_id: Optional[str] = rest_field( + name="azureResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The azure resource Id of the resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The location of the resource.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The hosting type of the resource.""" + + @overload + def __init__( + self, + *, + partner_deployment_name: Optional[str] = None, + partner_deployment_uri: Optional[str] = None, + azure_resource_id: Optional[str] = None, + location: 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 ConnectedPartnerResourcesListFormat(_Model): + """Connected Partner Resources List Format. + + :ivar properties: Connected Partner Resource Properties. + :vartype properties: ~azure.mgmt.elastic.models.ConnectedPartnerResourceProperties + """ + + properties: Optional["_models.ConnectedPartnerResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Connected Partner Resource Properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ConnectedPartnerResourceProperties"] = 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 DeploymentInfoResponse(_Model): + """The properties of deployment in Elastic cloud corresponding to the Elastic monitor resource. + + :ivar status: The Elastic deployment status. Known values are: "Healthy" and "Unhealthy". + :vartype status: str or ~azure.mgmt.elastic.models.ElasticDeploymentStatus + :ivar version: Version of the elasticsearch in Elastic cloud deployment. + :vartype version: str + :ivar memory_capacity: RAM capacity of the elasticsearch in Elastic cloud deployment. + :vartype memory_capacity: str + :ivar disk_capacity: Disk capacity of the elasticsearch in Elastic cloud deployment. + :vartype disk_capacity: str + :ivar elasticsearch_end_point: Elasticsearch endpoint in Elastic cloud deployment. This is + either the aliased_endpoint if available, or the service_url otherwise. + :vartype elasticsearch_end_point: str + :ivar deployment_url: Deployment URL of the elasticsearch in Elastic cloud deployment. + :vartype deployment_url: str + :ivar marketplace_saas_info: Marketplace SaaS Info of the resource. + :vartype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo + :ivar project_type: Project Type - Applicable for Serverless only. + :vartype project_type: str + :ivar configuration_type: ConfigurationType Type - Applicable for Serverless only. + :vartype configuration_type: str + """ + + status: Optional[Union[str, "_models.ElasticDeploymentStatus"]] = rest_field(visibility=["read"]) + """The Elastic deployment status. Known values are: \"Healthy\" and \"Unhealthy\".""" + version: Optional[str] = rest_field(visibility=["read"]) + """Version of the elasticsearch in Elastic cloud deployment.""" + memory_capacity: Optional[str] = rest_field(name="memoryCapacity", visibility=["read"]) + """RAM capacity of the elasticsearch in Elastic cloud deployment.""" + disk_capacity: Optional[str] = rest_field(name="diskCapacity", visibility=["read"]) + """Disk capacity of the elasticsearch in Elastic cloud deployment.""" + elasticsearch_end_point: Optional[str] = rest_field(name="elasticsearchEndPoint", visibility=["read"]) + """Elasticsearch endpoint in Elastic cloud deployment. This is either the aliased_endpoint if + available, or the service_url otherwise.""" + deployment_url: Optional[str] = rest_field(name="deploymentUrl", visibility=["read"]) + """Deployment URL of the elasticsearch in Elastic cloud deployment.""" + marketplace_saas_info: Optional["_models.MarketplaceSaaSInfo"] = rest_field( + name="marketplaceSaasInfo", visibility=["read"] + ) + """Marketplace SaaS Info of the resource.""" + project_type: Optional[str] = rest_field(name="projectType", visibility=["read"]) + """Project Type - Applicable for Serverless only.""" + configuration_type: Optional[str] = rest_field(name="configurationType", visibility=["read"]) + """ConfigurationType Type - Applicable for Serverless only.""" + + +class ElasticCloudDeployment(_Model): + """Details of the user's elastic deployment associated with the monitor resource. + + :ivar name: Elastic deployment name. + :vartype name: str + :ivar deployment_id: Elastic deployment Id. + :vartype deployment_id: str + :ivar azure_subscription_id: Associated Azure subscription Id for the elastic deployment. + :vartype azure_subscription_id: str + :ivar elasticsearch_region: Region where Deployment at Elastic side took place. + :vartype elasticsearch_region: str + :ivar elasticsearch_service_url: Elasticsearch ingestion endpoint of the Elastic deployment. + :vartype elasticsearch_service_url: str + :ivar kibana_service_url: Kibana endpoint of the Elastic deployment. + :vartype kibana_service_url: str + :ivar kibana_sso_url: Kibana dashboard sso URL of the Elastic deployment. + :vartype kibana_sso_url: str + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Elastic deployment name.""" + deployment_id: Optional[str] = rest_field(name="deploymentId", visibility=["read"]) + """Elastic deployment Id.""" + azure_subscription_id: Optional[str] = rest_field(name="azureSubscriptionId", visibility=["read"]) + """Associated Azure subscription Id for the elastic deployment.""" + elasticsearch_region: Optional[str] = rest_field(name="elasticsearchRegion", visibility=["read"]) + """Region where Deployment at Elastic side took place.""" + elasticsearch_service_url: Optional[str] = rest_field(name="elasticsearchServiceUrl", visibility=["read"]) + """Elasticsearch ingestion endpoint of the Elastic deployment.""" + kibana_service_url: Optional[str] = rest_field(name="kibanaServiceUrl", visibility=["read"]) + """Kibana endpoint of the Elastic deployment.""" + kibana_sso_url: Optional[str] = rest_field(name="kibanaSsoUrl", visibility=["read"]) + """Kibana dashboard sso URL of the Elastic deployment.""" + + +class ElasticCloudUser(_Model): + """Details of the user's elastic account. + + :ivar email_address: Email of the Elastic User Account. + :vartype email_address: str + :ivar id: User Id of the elastic account of the User. + :vartype id: str + :ivar elastic_cloud_sso_default_url: Elastic cloud default dashboard sso URL of the Elastic + user account. + :vartype elastic_cloud_sso_default_url: str + """ + + email_address: Optional[str] = rest_field(name="emailAddress", visibility=["read"]) + """Email of the Elastic User Account.""" + id: Optional[str] = rest_field(visibility=["read"]) + """User Id of the elastic account of the User.""" + elastic_cloud_sso_default_url: Optional[str] = rest_field(name="elasticCloudSsoDefaultUrl", visibility=["read"]) + """Elastic cloud default dashboard sso URL of the Elastic user account.""" + + +class Resource(_Model): + """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.elastic.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """Tracked 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.elastic.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 ElasticMonitorResource(TrackedResource): + """Monitor 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.elastic.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: Properties of the monitor resource. + :vartype properties: ~azure.mgmt.elastic.models.MonitorProperties + :ivar kind: The kind of the Elastic resource - observability, security, search etc. + :vartype kind: str + :ivar sku: SKU of the monitor resource. + :vartype sku: ~azure.mgmt.elastic.models.ResourceSku + :ivar identity: Identity properties of the monitor resource. + :vartype identity: ~azure.mgmt.elastic.models.IdentityProperties + """ + + properties: Optional["_models.MonitorProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the monitor resource.""" + kind: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The kind of the Elastic resource - observability, security, search etc.""" + sku: Optional["_models.ResourceSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU of the monitor resource.""" + identity: Optional["_models.IdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity properties of the monitor resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.MonitorProperties"] = None, + kind: Optional[str] = None, + sku: Optional["_models.ResourceSku"] = None, + identity: Optional["_models.IdentityProperties"] = 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 ElasticMonitorResourceUpdateParameters(_Model): + """Monitor resource update parameters. + + :ivar tags: elastic monitor resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """elastic monitor resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ElasticMonitorUpgrade(_Model): + """Upgrade elastic monitor version. + + :ivar version: Version to which the elastic monitor should be upgraded to. + :vartype version: str + """ + + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Version to which the elastic monitor should be upgraded to.""" + + @overload + def __init__( + self, + *, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ElasticOrganizationToAzureSubscriptionMappingResponse(_Model): # pylint: disable=name-too-long + """The Azure Subscription ID to which the Organization of the logged in user belongs and gets + billed into. + + :ivar properties: The properties of Azure Subscription ID to which the Organization of the + logged in user belongs and gets billed into. + :vartype properties: + ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties + """ + + properties: Optional["_models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of Azure Subscription ID to which the Organization of the logged in user belongs + and gets billed into.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties"] = 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 ElasticOrganizationToAzureSubscriptionMappingResponseProperties(_Model): # pylint: disable=name-too-long + """The properties of Azure Subscription ID to which the Organization of the logged in user belongs + and gets billed into. + + :ivar billed_azure_subscription_id: The Azure Subscription ID to which the Organization belongs + and gets billed into. This is empty for a new user OR a user without an Elastic Organization. + :vartype billed_azure_subscription_id: str + :ivar marketplace_saas_info: Marketplace SaaS Info of the resource. + :vartype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo + :ivar elastic_organization_id: The Elastic Organization Id. + :vartype elastic_organization_id: str + :ivar elastic_organization_name: The Elastic Organization Name. + :vartype elastic_organization_name: str + """ + + billed_azure_subscription_id: Optional[str] = rest_field( + name="billedAzureSubscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Azure Subscription ID to which the Organization belongs and gets billed into. This is empty + for a new user OR a user without an Elastic Organization.""" + marketplace_saas_info: Optional["_models.MarketplaceSaaSInfo"] = rest_field( + name="marketplaceSaasInfo", visibility=["read"] + ) + """Marketplace SaaS Info of the resource.""" + elastic_organization_id: Optional[str] = rest_field( + name="elasticOrganizationId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Elastic Organization Id.""" + elastic_organization_name: Optional[str] = rest_field( + name="elasticOrganizationName", visibility=["read", "create", "update", "delete", "query"] + ) + """The Elastic Organization Name.""" + + @overload + def __init__( + self, + *, + billed_azure_subscription_id: Optional[str] = None, + elastic_organization_id: Optional[str] = None, + elastic_organization_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 ElasticProperties(_Model): + """Elastic Resource Properties. + + :ivar elastic_cloud_user: Details of the user's elastic account. + :vartype elastic_cloud_user: ~azure.mgmt.elastic.models.ElasticCloudUser + :ivar elastic_cloud_deployment: Details of the elastic cloud deployment. + :vartype elastic_cloud_deployment: ~azure.mgmt.elastic.models.ElasticCloudDeployment + """ + + elastic_cloud_user: Optional["_models.ElasticCloudUser"] = rest_field( + name="elasticCloudUser", visibility=["read", "create", "update", "delete", "query"] + ) + """Details of the user's elastic account.""" + elastic_cloud_deployment: Optional["_models.ElasticCloudDeployment"] = rest_field( + name="elasticCloudDeployment", visibility=["read", "create", "update", "delete", "query"] + ) + """Details of the elastic cloud deployment.""" + + @overload + def __init__( + self, + *, + elastic_cloud_user: Optional["_models.ElasticCloudUser"] = None, + elastic_cloud_deployment: Optional["_models.ElasticCloudDeployment"] = 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 ElasticTrafficFilter(_Model): + """Elastic traffic filter object. + + :ivar id: Id of the elastic filter. + :vartype id: str + :ivar name: Name of the elastic filter. + :vartype name: str + :ivar description: Description of the elastic filter. + :vartype description: str + :ivar region: Region of the elastic filter. + :vartype region: str + :ivar type: Type of the elastic filter. Known values are: "ip" and "azure_private_endpoint". + :vartype type: str or ~azure.mgmt.elastic.models.Type + :ivar include_by_default: IncludeByDefault for the elastic filter. + :vartype include_by_default: bool + :ivar rules: Rules in the elastic filter. + :vartype rules: list[~azure.mgmt.elastic.models.ElasticTrafficFilterRule] + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Id of the elastic filter.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the elastic filter.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description of the elastic filter.""" + region: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Region of the elastic filter.""" + type: Optional[Union[str, "_models.Type"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Type of the elastic filter. Known values are: \"ip\" and \"azure_private_endpoint\".""" + include_by_default: Optional[bool] = rest_field( + name="includeByDefault", visibility=["read", "create", "update", "delete", "query"] + ) + """IncludeByDefault for the elastic filter.""" + rules: Optional[list["_models.ElasticTrafficFilterRule"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Rules in the elastic filter.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + description: Optional[str] = None, + region: Optional[str] = None, + type: Optional[Union[str, "_models.Type"]] = None, + include_by_default: Optional[bool] = None, + rules: Optional[list["_models.ElasticTrafficFilterRule"]] = 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 ElasticTrafficFilterResponse(_Model): + """List of elastic traffic filters in the account. + + :ivar rulesets: List of elastic traffic filters in the account. + :vartype rulesets: list[~azure.mgmt.elastic.models.ElasticTrafficFilter] + """ + + rulesets: Optional[list["_models.ElasticTrafficFilter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of elastic traffic filters in the account.""" + + @overload + def __init__( + self, + *, + rulesets: Optional[list["_models.ElasticTrafficFilter"]] = 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 ElasticTrafficFilterRule(_Model): + """Elastic traffic filter rule object. + + :ivar source: IP of the elastic filter rule. + :vartype source: str + :ivar description: Description of the elastic filter rule. + :vartype description: str + :ivar azure_endpoint_guid: Guid of Private Endpoint in the elastic filter rule. + :vartype azure_endpoint_guid: str + :ivar azure_endpoint_name: Name of the Private Endpoint in the elastic filter rule. + :vartype azure_endpoint_name: str + :ivar id: Id of the elastic filter rule. + :vartype id: str + """ + + source: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """IP of the elastic filter rule.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description of the elastic filter rule.""" + azure_endpoint_guid: Optional[str] = rest_field( + name="azureEndpointGuid", visibility=["read", "create", "update", "delete", "query"] + ) + """Guid of Private Endpoint in the elastic filter rule.""" + azure_endpoint_name: Optional[str] = rest_field( + name="azureEndpointName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the Private Endpoint in the elastic filter rule.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Id of the elastic filter rule.""" + + @overload + def __init__( + self, + *, + source: Optional[str] = None, + description: Optional[str] = None, + azure_endpoint_guid: Optional[str] = None, + azure_endpoint_name: Optional[str] = None, + 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 ElasticVersionListFormat(_Model): + """Elastic Version List Format. + + :ivar properties: Elastic Version Properties. + :vartype properties: ~azure.mgmt.elastic.models.ElasticVersionListProperties + """ + + properties: Optional["_models.ElasticVersionListProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Elastic Version Properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ElasticVersionListProperties"] = 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 ElasticVersionListProperties(_Model): + """Elastic Version Properties. + + :ivar version: Available elastic version of the given region. + :vartype version: str + """ + + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Available elastic version of the given region.""" + + @overload + def __init__( + self, + *, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class 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.elastic.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.elastic.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.elastic.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 ErrorResponseBody(_Model): + """Error response body. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar target: Error target. + :vartype target: str + :ivar details: Error details. + :vartype details: list[~azure.mgmt.elastic.models.ErrorResponseBody] + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error target.""" + details: Optional[list["_models.ErrorResponseBody"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Error details.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[list["_models.ErrorResponseBody"]] = 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 ExternalUserCreationResponse(_Model): + """The properties of the response we got from elastic while creating external user. + + :ivar created: Shows if user is created or updated. + :vartype created: bool + """ + + created: Optional[bool] = rest_field(visibility=["read"]) + """Shows if user is created or updated.""" + + +class ExternalUserInfo(_Model): + """The properties of the request required for creating user on elastic side. + + :ivar user_name: Username of the user to be created or updated. + :vartype user_name: str + :ivar full_name: Full name of the user to be created or updated. + :vartype full_name: str + :ivar password: Password of the user to be created or updated. + :vartype password: str + :ivar email_id: Email id of the user to be created or updated. + :vartype email_id: str + :ivar roles: Roles to be assigned for created or updated user. + :vartype roles: list[str] + """ + + user_name: Optional[str] = rest_field(name="userName", visibility=["read", "create", "update", "delete", "query"]) + """Username of the user to be created or updated.""" + full_name: Optional[str] = rest_field(name="fullName", visibility=["read", "create", "update", "delete", "query"]) + """Full name of the user to be created or updated.""" + password: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Password of the user to be created or updated.""" + email_id: Optional[str] = rest_field(name="emailId", visibility=["read", "create", "update", "delete", "query"]) + """Email id of the user to be created or updated.""" + roles: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Roles to be assigned for created or updated user.""" + + @overload + def __init__( + self, + *, + user_name: Optional[str] = None, + full_name: Optional[str] = None, + password: Optional[str] = None, + email_id: Optional[str] = None, + roles: 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 FilteringTag(_Model): + """The definition of a filtering tag. Filtering tags are used for capturing resources and + include/exclude them from being monitored. + + :ivar name: The name (also known as the key) of the tag. + :vartype name: str + :ivar value: The value of the tag. + :vartype value: str + :ivar action: Valid actions for a filtering tag. Known values are: "Include" and "Exclude". + :vartype action: str or ~azure.mgmt.elastic.models.TagAction + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name (also known as the key) of the tag.""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The value of the tag.""" + action: Optional[Union[str, "_models.TagAction"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Valid actions for a filtering tag. Known values are: \"Include\" and \"Exclude\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + action: Optional[Union[str, "_models.TagAction"]] = 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 IdentityProperties(_Model): + """Identity properties. + + :ivar principal_id: The identity ID. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: Managed identity type. "SystemAssigned" + :vartype type: str or ~azure.mgmt.elastic.models.ManagedIdentityTypes + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The identity ID.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of resource.""" + type: Optional[Union[str, "_models.ManagedIdentityTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Managed identity type. \"SystemAssigned\"""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ManagedIdentityTypes"]] = 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 LogRules(_Model): + """Set of rules for sending logs for the Monitor resource. + + :ivar send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :vartype send_aad_logs: bool + :ivar send_subscription_logs: Flag specifying if subscription logs should be sent for the + Monitor resource. + :vartype send_subscription_logs: bool + :ivar send_activity_logs: Flag specifying if activity logs from Azure resources should be sent + for the Monitor resource. + :vartype send_activity_logs: bool + :ivar filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :vartype filtering_tags: list[~azure.mgmt.elastic.models.FilteringTag] + """ + + send_aad_logs: Optional[bool] = rest_field( + name="sendAadLogs", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag specifying if AAD logs should be sent for the Monitor resource.""" + send_subscription_logs: Optional[bool] = rest_field( + name="sendSubscriptionLogs", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag specifying if subscription logs should be sent for the Monitor resource.""" + send_activity_logs: Optional[bool] = rest_field( + name="sendActivityLogs", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag specifying if activity logs from Azure resources should be sent for the Monitor resource.""" + filtering_tags: Optional[list["_models.FilteringTag"]] = rest_field( + name="filteringTags", visibility=["read", "create", "update", "delete", "query"] + ) + """List of filtering tags to be used for capturing logs. This only takes effect if + SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude + action is specified, the rules will apply to the list of all available resources. If Include + actions are specified, the rules will only include resources with the associated tags.""" + + @overload + def __init__( + self, + *, + send_aad_logs: Optional[bool] = None, + send_subscription_logs: Optional[bool] = None, + send_activity_logs: Optional[bool] = None, + filtering_tags: Optional[list["_models.FilteringTag"]] = 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 MarketplaceSaaSInfo(_Model): + """Marketplace SAAS Info of the resource. + + :ivar marketplace_subscription: Marketplace Subscription. + :vartype marketplace_subscription: + ~azure.mgmt.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription + :ivar marketplace_name: Marketplace Subscription Details: SAAS Name. + :vartype marketplace_name: str + :ivar marketplace_resource_id: Marketplace Subscription Details: Resource URI. + :vartype marketplace_resource_id: str + :ivar marketplace_status: Marketplace Subscription Details: SaaS Subscription Status. + :vartype marketplace_status: str + :ivar billed_azure_subscription_id: The Azure Subscription ID to which the Marketplace + Subscription belongs and gets billed into. + :vartype billed_azure_subscription_id: str + :ivar subscribed: Flag specifying if the Marketplace status is subscribed or not. + :vartype subscribed: bool + """ + + marketplace_subscription: Optional["_models.MarketplaceSaaSInfoMarketplaceSubscription"] = rest_field( + name="marketplaceSubscription", visibility=["read", "create", "update", "delete", "query"] + ) + """Marketplace Subscription.""" + marketplace_name: Optional[str] = rest_field( + name="marketplaceName", visibility=["read", "create", "update", "delete", "query"] + ) + """Marketplace Subscription Details: SAAS Name.""" + marketplace_resource_id: Optional[str] = rest_field( + name="marketplaceResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Marketplace Subscription Details: Resource URI.""" + marketplace_status: Optional[str] = rest_field( + name="marketplaceStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Marketplace Subscription Details: SaaS Subscription Status.""" + billed_azure_subscription_id: Optional[str] = rest_field( + name="billedAzureSubscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Azure Subscription ID to which the Marketplace Subscription belongs and gets billed into.""" + subscribed: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Flag specifying if the Marketplace status is subscribed or not.""" + + @overload + def __init__( + self, + *, + marketplace_subscription: Optional["_models.MarketplaceSaaSInfoMarketplaceSubscription"] = None, + marketplace_name: Optional[str] = None, + marketplace_resource_id: Optional[str] = None, + marketplace_status: Optional[str] = None, + billed_azure_subscription_id: Optional[str] = None, + subscribed: 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 MarketplaceSaaSInfoMarketplaceSubscription(_Model): # pylint: disable=name-too-long + """Marketplace Subscription. + + :ivar id: Marketplace Subscription Id. This is a GUID-formatted string. + :vartype id: str + :ivar publisher_id: Publisher Id of the Marketplace offer. + :vartype publisher_id: str + :ivar offer_id: Offer Id of the Marketplace offer,. + :vartype offer_id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Marketplace Subscription Id. This is a GUID-formatted string.""" + publisher_id: Optional[str] = rest_field( + name="publisherId", visibility=["read", "create", "update", "delete", "query"] + ) + """Publisher Id of the Marketplace offer.""" + offer_id: Optional[str] = rest_field(name="offerId", visibility=["read", "create", "update", "delete", "query"]) + """Offer Id of the Marketplace offer,.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + publisher_id: Optional[str] = None, + offer_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MonitoredResource(_Model): + """The properties of a resource currently being monitored by the Elastic monitor resource. + + :ivar id: The ARM id of the resource. + :vartype id: str + :ivar sending_logs: Flag indicating the status of the resource for sending logs operation to + Elastic. Known values are: "True" and "False". + :vartype sending_logs: str or ~azure.mgmt.elastic.models.SendingLogs + :ivar reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + sending). + :vartype reason_for_logs_status: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ARM id of the resource.""" + sending_logs: Optional[Union[str, "_models.SendingLogs"]] = rest_field( + name="sendingLogs", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag indicating the status of the resource for sending logs operation to Elastic. Known values + are: \"True\" and \"False\".""" + reason_for_logs_status: Optional[str] = rest_field( + name="reasonForLogsStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Reason for why the resource is sending logs (or why it is not sending).""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + sending_logs: Optional[Union[str, "_models.SendingLogs"]] = None, + reason_for_logs_status: 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 MonitoredSubscription(_Model): + """The list of subscriptions and it's monitoring status by current Elastic monitor. + + :ivar subscription_id: The subscriptionId to be monitored. Required. + :vartype subscription_id: str + :ivar status: The state of monitoring. Known values are: "InProgress", "Active", "Failed", and + "Deleting". + :vartype status: str or ~azure.mgmt.elastic.models.Status + :ivar error: The reason of not monitoring the subscription. + :vartype error: str + :ivar tag_rules: Definition of the properties for a TagRules resource. + :vartype tag_rules: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties + """ + + subscription_id: str = rest_field(name="subscriptionId", visibility=["read", "create", "update", "delete", "query"]) + """The subscriptionId to be monitored. Required.""" + status: Optional[Union[str, "_models.Status"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The state of monitoring. Known values are: \"InProgress\", \"Active\", \"Failed\", and + \"Deleting\".""" + error: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reason of not monitoring the subscription.""" + tag_rules: Optional["_models.MonitoringTagRulesProperties"] = rest_field( + name="tagRules", visibility=["read", "create", "update", "delete", "query"] + ) + """Definition of the properties for a TagRules resource.""" + + @overload + def __init__( + self, + *, + subscription_id: str, + status: Optional[Union[str, "_models.Status"]] = None, + error: Optional[str] = None, + tag_rules: Optional["_models.MonitoringTagRulesProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProxyResource(Resource): + """Proxy 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.elastic.models.SystemData + """ + + +class MonitoredSubscriptionProperties(ProxyResource): + """The request to update subscriptions needed to be monitored by the Elastic monitor 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.elastic.models.SystemData + :ivar properties: The request to update subscriptions needed to be monitored by the Elastic + monitor resource. + :vartype properties: ~azure.mgmt.elastic.models.SubscriptionList + """ + + properties: Optional["_models.SubscriptionList"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The request to update subscriptions needed to be monitored by the Elastic monitor resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.SubscriptionList"] = 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 MonitoringTagRules(ProxyResource): + """Capture logs and metrics of Azure resources based on ARM tags. + + :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.elastic.models.SystemData + :ivar properties: Properties of the monitoring tag rules. + :vartype properties: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties + """ + + properties: Optional["_models.MonitoringTagRulesProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the monitoring tag rules.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.MonitoringTagRulesProperties"] = 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 MonitoringTagRulesProperties(_Model): + """Definition of the properties for a TagRules resource. + + :ivar provisioning_state: Provisioning state of the monitoring tag rules. Known values are: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState + :ivar log_rules: Rules for sending logs. + :vartype log_rules: ~azure.mgmt.elastic.models.LogRules + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the monitoring tag rules. Known values are: \"Accepted\", \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and + \"NotSpecified\".""" + log_rules: Optional["_models.LogRules"] = rest_field( + name="logRules", visibility=["read", "create", "update", "delete", "query"] + ) + """Rules for sending logs.""" + + @overload + def __init__( + self, + *, + log_rules: Optional["_models.LogRules"] = 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 MonitorProperties(_Model): + """Properties specific to the monitor resource. + + :ivar provisioning_state: Provisioning state of the monitor resource. Known values are: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Known values are: "Enabled" and "Disabled". + :vartype monitoring_status: str or ~azure.mgmt.elastic.models.MonitoringStatus + :ivar elastic_properties: Elastic cloud properties. + :vartype elastic_properties: ~azure.mgmt.elastic.models.ElasticProperties + :ivar user_info: User information. + :vartype user_info: ~azure.mgmt.elastic.models.UserInfo + :ivar plan_details: Plan details of the monitor resource. + :vartype plan_details: ~azure.mgmt.elastic.models.PlanDetails + :ivar version: Version of elastic of the monitor resource. + :vartype version: str + :ivar subscription_state: State of the Azure Subscription containing the monitor resource. + :vartype subscription_state: str + :ivar saa_s_azure_subscription_status: Status of Azure Subscription where Marketplace SaaS is + located. + :vartype saa_s_azure_subscription_status: str + :ivar source_campaign_name: Name of the marketing campaign. + :vartype source_campaign_name: str + :ivar source_campaign_id: A unique identifier associated with the campaign. + :vartype source_campaign_id: str + :ivar liftr_resource_category: Known values are: "Unknown" and "MonitorLogs". + :vartype liftr_resource_category: str or ~azure.mgmt.elastic.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + :ivar generate_api_key: Flag to determine if User API Key has to be generated and shared. + :vartype generate_api_key: bool + :ivar hosting_type: Hosting type of the monitor resource - either Hosted deployments OR + Serverless Projects. Known values are: "Hosted" and "Serverless". + :vartype hosting_type: str or ~azure.mgmt.elastic.models.HostingType + :ivar project_details: Project details of the monitor resource IF it belongs to Serverless + offer kind. + :vartype project_details: ~azure.mgmt.elastic.models.ProjectDetails + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the monitor resource. Known values are: \"Accepted\", \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and + \"NotSpecified\".""" + monitoring_status: Optional[Union[str, "_models.MonitoringStatus"]] = rest_field( + name="monitoringStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag specifying if the resource monitoring is enabled or disabled. Known values are: + \"Enabled\" and \"Disabled\".""" + elastic_properties: Optional["_models.ElasticProperties"] = rest_field( + name="elasticProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Elastic cloud properties.""" + user_info: Optional["_models.UserInfo"] = rest_field(name="userInfo", visibility=["create"]) + """User information.""" + plan_details: Optional["_models.PlanDetails"] = rest_field( + name="planDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Plan details of the monitor resource.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Version of elastic of the monitor resource.""" + subscription_state: Optional[str] = rest_field( + name="subscriptionState", visibility=["read", "create", "update", "delete", "query"] + ) + """State of the Azure Subscription containing the monitor resource.""" + saa_s_azure_subscription_status: Optional[str] = rest_field( + name="saaSAzureSubscriptionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Status of Azure Subscription where Marketplace SaaS is located.""" + source_campaign_name: Optional[str] = rest_field( + name="sourceCampaignName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the marketing campaign.""" + source_campaign_id: Optional[str] = rest_field( + name="sourceCampaignId", visibility=["read", "create", "update", "delete", "query"] + ) + """A unique identifier associated with the campaign.""" + liftr_resource_category: Optional[Union[str, "_models.LiftrResourceCategories"]] = rest_field( + name="liftrResourceCategory", visibility=["read"] + ) + """Known values are: \"Unknown\" and \"MonitorLogs\".""" + liftr_resource_preference: Optional[int] = rest_field(name="liftrResourcePreference", visibility=["read"]) + """The priority of the resource.""" + generate_api_key: Optional[bool] = rest_field( + name="generateApiKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to determine if User API Key has to be generated and shared.""" + hosting_type: Optional[Union[str, "_models.HostingType"]] = rest_field( + name="hostingType", visibility=["read", "create", "update", "delete", "query"] + ) + """Hosting type of the monitor resource - either Hosted deployments OR Serverless Projects. Known + values are: \"Hosted\" and \"Serverless\".""" + project_details: Optional["_models.ProjectDetails"] = rest_field( + name="projectDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Project details of the monitor resource IF it belongs to Serverless offer kind.""" + + @overload + def __init__( + self, + *, + monitoring_status: Optional[Union[str, "_models.MonitoringStatus"]] = None, + elastic_properties: Optional["_models.ElasticProperties"] = None, + user_info: Optional["_models.UserInfo"] = None, + plan_details: Optional["_models.PlanDetails"] = None, + version: Optional[str] = None, + subscription_state: Optional[str] = None, + saa_s_azure_subscription_status: Optional[str] = None, + source_campaign_name: Optional[str] = None, + source_campaign_id: Optional[str] = None, + generate_api_key: Optional[bool] = None, + hosting_type: Optional[Union[str, "_models.HostingType"]] = None, + project_details: Optional["_models.ProjectDetails"] = 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 OpenAIIntegrationProperties(_Model): + """Open AI Integration details. + + :ivar open_ai_resource_id: The resource name of Open AI resource. + :vartype open_ai_resource_id: str + :ivar open_ai_resource_endpoint: The API endpoint for Open AI resource. + :vartype open_ai_resource_endpoint: str + :ivar open_ai_connector_id: The connector id of Open AI resource. + :vartype open_ai_connector_id: str + :ivar key: Value of API key for Open AI resource. + :vartype key: str + :ivar last_refresh_at: Last Update Timestamp for key updation. + :vartype last_refresh_at: ~datetime.datetime + """ + + open_ai_resource_id: Optional[str] = rest_field( + name="openAIResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource name of Open AI resource.""" + open_ai_resource_endpoint: Optional[str] = rest_field( + name="openAIResourceEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """The API endpoint for Open AI resource.""" + open_ai_connector_id: Optional[str] = rest_field( + name="openAIConnectorId", visibility=["read", "create", "update", "delete", "query"] + ) + """The connector id of Open AI resource.""" + key: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Value of API key for Open AI resource.""" + last_refresh_at: Optional[datetime.datetime] = rest_field( + name="lastRefreshAt", visibility=["read"], format="rfc3339" + ) + """Last Update Timestamp for key updation.""" + + @overload + def __init__( + self, + *, + open_ai_resource_id: Optional[str] = None, + open_ai_resource_endpoint: Optional[str] = None, + open_ai_connector_id: Optional[str] = None, + key: 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 OpenAIIntegrationRPModel(ProxyResource): + """Capture properties of Open AI resource Integration. + + :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.elastic.models.SystemData + :ivar properties: Open AI Integration details. + :vartype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationProperties + """ + + properties: Optional["_models.OpenAIIntegrationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Open AI Integration details.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.OpenAIIntegrationProperties"] = 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 OpenAIIntegrationStatusResponse(_Model): + """Status of the OpenAI Integration. + + :ivar properties: Status of the OpenAI Integration. + :vartype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponseProperties + """ + + properties: Optional["_models.OpenAIIntegrationStatusResponseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Status of the OpenAI Integration.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.OpenAIIntegrationStatusResponseProperties"] = 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 OpenAIIntegrationStatusResponseProperties(_Model): # pylint: disable=name-too-long + """Status of the OpenAI Integration. + + :ivar status: Status of the OpenAI Integration. + :vartype status: str + """ + + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Status of the OpenAI Integration.""" + + @overload + def __init__( + self, + *, + status: 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 OperationDisplay(_Model): + """Represents the display information for an operation. + + :ivar provider: The service provider of the operation. + :vartype provider: str + :ivar resource: The resource type of the operation. + :vartype resource: str + :ivar operation: The name of the operation. + :vartype operation: str + :ivar description: A description of the operation. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The service provider of the operation.""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource type of the operation.""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the operation.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A description of the operation.""" + + @overload + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: 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 OperationResult(_Model): + """A Microsoft.Elastic REST API operation. + + :ivar name: Operation name, i.e., {provider}/{resource}/{operation}. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.elastic.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation name, i.e., {provider}/{resource}/{operation}.""" + is_data_action: Optional[bool] = rest_field( + name="isDataAction", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the operation is a data action.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The object that represents the operation.""" + origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Origin of the operation.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: 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 PartnerBillingEntity(_Model): + """Partner Billing details associated with the resource. + + :ivar id: The Elastic Organization Id. + :vartype id: str + :ivar name: The Elastic Organization Name. + :vartype name: str + :ivar partner_entity_uri: Link to the elastic organization page. + :vartype partner_entity_uri: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Elastic Organization Id.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Elastic Organization Name.""" + partner_entity_uri: Optional[str] = rest_field( + name="partnerEntityUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Link to the elastic organization page.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + partner_entity_uri: 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 PlanDetails(_Model): + """Plan details of the monitor resource. + + :ivar offer_id: Offer ID of the plan. + :vartype offer_id: str + :ivar publisher_id: Publisher ID of the plan. + :vartype publisher_id: str + :ivar term_id: Term ID of the plan. + :vartype term_id: str + :ivar plan_id: Plan ID. + :vartype plan_id: str + :ivar plan_name: Plan Name. + :vartype plan_name: str + """ + + offer_id: Optional[str] = rest_field(name="offerID", visibility=["read", "create", "update", "delete", "query"]) + """Offer ID of the plan.""" + publisher_id: Optional[str] = rest_field( + name="publisherID", visibility=["read", "create", "update", "delete", "query"] + ) + """Publisher ID of the plan.""" + term_id: Optional[str] = rest_field(name="termID", visibility=["read", "create", "update", "delete", "query"]) + """Term ID of the plan.""" + plan_id: Optional[str] = rest_field(name="planID", visibility=["read", "create", "update", "delete", "query"]) + """Plan ID.""" + plan_name: Optional[str] = rest_field(name="planName", visibility=["read", "create", "update", "delete", "query"]) + """Plan Name.""" + + @overload + def __init__( + self, + *, + offer_id: Optional[str] = None, + publisher_id: Optional[str] = None, + term_id: Optional[str] = None, + plan_id: Optional[str] = None, + plan_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 ProjectDetails(_Model): + """Project details of the monitor resource IF it belongs to Serverless offer kind. + + :ivar project_type: Project type; ex: Elasticsearch / Observability / Security. Known values + are: "Elasticsearch", "Observability", "Security", and "NotApplicable". + :vartype project_type: str or ~azure.mgmt.elastic.models.ProjectType + :ivar configuration_type: Configuration type of the Elasticsearch project. Known values are: + "GeneralPurpose", "Vector", "TimeSeries", and "NotApplicable". + :vartype configuration_type: str or ~azure.mgmt.elastic.models.ConfigurationType + """ + + project_type: Optional[Union[str, "_models.ProjectType"]] = rest_field( + name="projectType", visibility=["read", "create", "update", "delete", "query"] + ) + """Project type; ex: Elasticsearch / Observability / Security. Known values are: + \"Elasticsearch\", \"Observability\", \"Security\", and \"NotApplicable\".""" + configuration_type: Optional[Union[str, "_models.ConfigurationType"]] = rest_field( + name="configurationType", visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration type of the Elasticsearch project. Known values are: \"GeneralPurpose\", + \"Vector\", \"TimeSeries\", and \"NotApplicable\".""" + + @overload + def __init__( + self, + *, + project_type: Optional[Union[str, "_models.ProjectType"]] = None, + configuration_type: Optional[Union[str, "_models.ConfigurationType"]] = 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 ResourceProviderDefaultErrorResponse(_Model): + """RP default error response. + + :ivar error: Response body of Error. + :vartype error: ~azure.mgmt.elastic.models.ErrorResponseBody + """ + + error: Optional["_models.ErrorResponseBody"] = rest_field(visibility=["read"]) + """Response body of Error.""" + + +class ResourceSku(_Model): + """Represents the SKU of a resource. + + :ivar name: The name of the SKU. Required. + :vartype name: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the SKU. Required.""" + + @overload + def __init__( + self, + *, + name: 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 ResubscribeProperties(_Model): + """Resubscribe Properties. + + :ivar plan_id: Newly selected plan Id to create the new Marketplace subscription for + Resubscribe. + :vartype plan_id: str + :ivar term: Newly selected term to create the new Marketplace subscription for Resubscribe. + :vartype term: str + :ivar subscription_id: Newly selected Azure Subscription Id in which the new Marketplace + subscription will be created for Resubscribe. + :vartype subscription_id: str + :ivar resource_group: Newly selected Azure resource group in which the new Marketplace + subscription will be created for Resubscribe. + :vartype resource_group: str + :ivar organization_id: Organization Id of the Elastic Organization that needs to be + resubscribed. + :vartype organization_id: str + """ + + plan_id: Optional[str] = rest_field(name="planId", visibility=["read", "create", "update", "delete", "query"]) + """Newly selected plan Id to create the new Marketplace subscription for Resubscribe.""" + term: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Newly selected term to create the new Marketplace subscription for Resubscribe.""" + subscription_id: Optional[str] = rest_field( + name="subscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """Newly selected Azure Subscription Id in which the new Marketplace subscription will be created + for Resubscribe.""" + resource_group: Optional[str] = rest_field( + name="resourceGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Newly selected Azure resource group in which the new Marketplace subscription will be created + for Resubscribe.""" + organization_id: Optional[str] = rest_field( + name="organizationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Organization Id of the Elastic Organization that needs to be resubscribed.""" + + @overload + def __init__( + self, + *, + plan_id: Optional[str] = None, + term: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + organization_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SubscriptionList(_Model): + """The request to update subscriptions needed to be monitored by the Elastic monitor resource. + + :ivar operation: The operation for the patch on the resource. Known values are: "AddBegin", + "AddComplete", "DeleteBegin", "DeleteComplete", and "Active". + :vartype operation: str or ~azure.mgmt.elastic.models.Operation + :ivar monitored_subscription_list: List of subscriptions and the state of the monitoring. + :vartype monitored_subscription_list: list[~azure.mgmt.elastic.models.MonitoredSubscription] + :ivar provisioning_state: Provisioning State of the resource. Known values are: "Accepted", + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and + "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState + """ + + operation: Optional[Union[str, "_models.Operation"]] = rest_field(visibility=["create", "update"]) + """The operation for the patch on the resource. Known values are: \"AddBegin\", \"AddComplete\", + \"DeleteBegin\", \"DeleteComplete\", and \"Active\".""" + monitored_subscription_list: Optional[list["_models.MonitoredSubscription"]] = rest_field( + name="monitoredSubscriptionList", visibility=["read", "create", "update", "delete", "query"] + ) + """List of subscriptions and the state of the monitoring.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning State of the resource. Known values are: \"Accepted\", \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + + @overload + def __init__( + self, + *, + operation: Optional[Union[str, "_models.Operation"]] = None, + monitored_subscription_list: Optional[list["_models.MonitoredSubscription"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """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.elastic.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.elastic.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 UpgradableVersionsList(_Model): + """Stack Versions that this version can upgrade to. + + :ivar current_version: Current version of the elastic monitor. + :vartype current_version: str + :ivar upgradable_versions: Stack Versions that this version can upgrade to. + :vartype upgradable_versions: list[str] + """ + + current_version: Optional[str] = rest_field( + name="currentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Current version of the elastic monitor.""" + upgradable_versions: Optional[list[str]] = rest_field( + name="upgradableVersions", visibility=["read", "create", "update", "delete", "query"] + ) + """Stack Versions that this version can upgrade to.""" + + @overload + def __init__( + self, + *, + current_version: Optional[str] = None, + upgradable_versions: 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 UserApiKeyResponse(_Model): + """The User Api Key created for the Organization associated with the User Email Id that was passed + in the request. + + :ivar properties: + :vartype properties: ~azure.mgmt.elastic.models.UserApiKeyResponseProperties + """ + + properties: Optional["_models.UserApiKeyResponseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + properties: Optional["_models.UserApiKeyResponseProperties"] = 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 UserApiKeyResponseProperties(_Model): + """UserApiKeyResponseProperties. + + :ivar api_key: The User Api Key Generated based on GenerateApiKey flag. This is applicable for + non-Portal clients only. + :vartype api_key: str + """ + + api_key: Optional[str] = rest_field(name="apiKey", visibility=["read", "create", "update", "delete", "query"]) + """The User Api Key Generated based on GenerateApiKey flag. This is applicable for non-Portal + clients only.""" + + @overload + def __init__( + self, + *, + api_key: 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 UserEmailId(_Model): + """Email Id of the User Organization, of which the API Key must be returned. + + :ivar email_id: The User email Id. + :vartype email_id: str + """ + + email_id: Optional[str] = rest_field(name="emailId", visibility=["read", "create", "update", "delete", "query"]) + """The User email Id.""" + + @overload + def __init__( + self, + *, + email_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserInfo(_Model): + """User Information to be passed to partners. + + :ivar first_name: First name of the user. + :vartype first_name: str + :ivar last_name: Last name of the user. + :vartype last_name: str + :ivar company_name: Company name of the user. + :vartype company_name: str + :ivar email_address: Email of the user used by Elastic for contacting them if needed. + :vartype email_address: str + :ivar company_info: Company information of the user to be passed to partners. + :vartype company_info: ~azure.mgmt.elastic.models.CompanyInfo + """ + + first_name: Optional[str] = rest_field(name="firstName", visibility=["read", "create", "update", "delete", "query"]) + """First name of the user.""" + last_name: Optional[str] = rest_field(name="lastName", visibility=["read", "create", "update", "delete", "query"]) + """Last name of the user.""" + company_name: Optional[str] = rest_field( + name="companyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Company name of the user.""" + email_address: Optional[str] = rest_field( + name="emailAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Email of the user used by Elastic for contacting them if needed.""" + company_info: Optional["_models.CompanyInfo"] = rest_field( + name="companyInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Company information of the user to be passed to partners.""" + + @overload + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + company_name: Optional[str] = None, + email_address: Optional[str] = None, + company_info: Optional["_models.CompanyInfo"] = 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 VMCollectionUpdate(_Model): + """Update VM resource collection. + + :ivar vm_resource_id: ARM id of the VM resource. + :vartype vm_resource_id: str + :ivar operation_name: Operation to be performed for given VM. Known values are: "Add" and + "Delete". + :vartype operation_name: str or ~azure.mgmt.elastic.models.OperationName + """ + + vm_resource_id: Optional[str] = rest_field( + name="vmResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM id of the VM resource.""" + operation_name: Optional[Union[str, "_models.OperationName"]] = rest_field( + name="operationName", visibility=["read", "create", "update", "delete", "query"] + ) + """Operation to be performed for given VM. Known values are: \"Add\" and \"Delete\".""" + + @overload + def __init__( + self, + *, + vm_resource_id: Optional[str] = None, + operation_name: Optional[Union[str, "_models.OperationName"]] = 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 VMIngestionDetailsResponse(_Model): + """The vm ingestion details to install an agent. + + :ivar cloud_id: The cloudId of given Elastic monitor resource. + :vartype cloud_id: str + :ivar ingestion_key: Ingestion details to install agent on given VM. + :vartype ingestion_key: str + """ + + cloud_id: Optional[str] = rest_field(name="cloudId", visibility=["read", "create", "update", "delete", "query"]) + """The cloudId of given Elastic monitor resource.""" + ingestion_key: Optional[str] = rest_field( + name="ingestionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Ingestion details to install agent on given VM.""" + + @overload + def __init__( + self, + *, + cloud_id: Optional[str] = None, + ingestion_key: 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 VMResources(_Model): + """The vm resource properties that is currently being monitored by the Elastic monitor resource. + + :ivar vm_resource_id: The ARM id of the VM resource. + :vartype vm_resource_id: str + """ + + vm_resource_id: Optional[str] = rest_field( + name="vmResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM id of the VM resource.""" + + @overload + def __init__( + self, + *, + vm_resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py deleted file mode 100644 index 86e8b9d23729..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py +++ /dev/null @@ -1,2646 +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 collections.abc import MutableMapping -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class BillingInfoResponse(_serialization.Model): - """Marketplace Subscription and Organization details to which resource gets billed into. - - :ivar marketplace_saas_info: Marketplace Subscription details. - :vartype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo - :ivar partner_billing_entity: Partner Billing Entity details: Organization Info. - :vartype partner_billing_entity: ~azure.mgmt.elastic.models.PartnerBillingEntity - """ - - _attribute_map = { - "marketplace_saas_info": {"key": "marketplaceSaasInfo", "type": "MarketplaceSaaSInfo"}, - "partner_billing_entity": {"key": "partnerBillingEntity", "type": "PartnerBillingEntity"}, - } - - def __init__( - self, - *, - marketplace_saas_info: Optional["_models.MarketplaceSaaSInfo"] = None, - partner_billing_entity: Optional["_models.PartnerBillingEntity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword marketplace_saas_info: Marketplace Subscription details. - :paramtype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo - :keyword partner_billing_entity: Partner Billing Entity details: Organization Info. - :paramtype partner_billing_entity: ~azure.mgmt.elastic.models.PartnerBillingEntity - """ - super().__init__(**kwargs) - self.marketplace_saas_info = marketplace_saas_info - self.partner_billing_entity = partner_billing_entity - - -class CompanyInfo(_serialization.Model): - """Company information of the user to be passed to partners. - - :ivar domain: Domain of the company. - :vartype domain: str - :ivar business: Business of the company. - :vartype business: str - :ivar employees_number: Number of employees in the company. - :vartype employees_number: str - :ivar state: State of the company location. - :vartype state: str - :ivar country: Country of the company location. - :vartype country: str - """ - - _validation = { - "domain": {"max_length": 256}, - "business": {"max_length": 128}, - "employees_number": {"max_length": 20}, - "state": {"max_length": 128}, - "country": {"max_length": 128}, - } - - _attribute_map = { - "domain": {"key": "domain", "type": "str"}, - "business": {"key": "business", "type": "str"}, - "employees_number": {"key": "employeesNumber", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "country": {"key": "country", "type": "str"}, - } - - def __init__( - self, - *, - domain: Optional[str] = None, - business: Optional[str] = None, - employees_number: Optional[str] = None, - state: Optional[str] = None, - country: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword domain: Domain of the company. - :paramtype domain: str - :keyword business: Business of the company. - :paramtype business: str - :keyword employees_number: Number of employees in the company. - :paramtype employees_number: str - :keyword state: State of the company location. - :paramtype state: str - :keyword country: Country of the company location. - :paramtype country: str - """ - super().__init__(**kwargs) - self.domain = domain - self.business = business - self.employees_number = employees_number - self.state = state - self.country = country - - -class ConnectedPartnerResourceProperties(_serialization.Model): - """Connected Partner Resource Properties. - - :ivar partner_deployment_name: Elastic resource name. - :vartype partner_deployment_name: str - :ivar partner_deployment_uri: URL of the resource in Elastic cloud. - :vartype partner_deployment_uri: str - :ivar azure_resource_id: The azure resource Id of the resource. - :vartype azure_resource_id: str - :ivar location: The location of the resource. - :vartype location: str - :ivar type: The hosting type of the resource. - :vartype type: str - """ - - _attribute_map = { - "partner_deployment_name": {"key": "partnerDeploymentName", "type": "str"}, - "partner_deployment_uri": {"key": "partnerDeploymentUri", "type": "str"}, - "azure_resource_id": {"key": "azureResourceId", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - partner_deployment_name: Optional[str] = None, - partner_deployment_uri: Optional[str] = None, - azure_resource_id: Optional[str] = None, - location: Optional[str] = None, - type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword partner_deployment_name: Elastic resource name. - :paramtype partner_deployment_name: str - :keyword partner_deployment_uri: URL of the resource in Elastic cloud. - :paramtype partner_deployment_uri: str - :keyword azure_resource_id: The azure resource Id of the resource. - :paramtype azure_resource_id: str - :keyword location: The location of the resource. - :paramtype location: str - :keyword type: The hosting type of the resource. - :paramtype type: str - """ - super().__init__(**kwargs) - self.partner_deployment_name = partner_deployment_name - self.partner_deployment_uri = partner_deployment_uri - self.azure_resource_id = azure_resource_id - self.location = location - self.type = type - - -class ConnectedPartnerResourcesListFormat(_serialization.Model): - """Connected Partner Resources List Format. - - :ivar properties: Connected Partner Resource Properties. - :vartype properties: ~azure.mgmt.elastic.models.ConnectedPartnerResourceProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ConnectedPartnerResourceProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.ConnectedPartnerResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Connected Partner Resource Properties. - :paramtype properties: ~azure.mgmt.elastic.models.ConnectedPartnerResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConnectedPartnerResourcesListResponse(_serialization.Model): - """List of all active elastic deployments. - - :ivar value: Results of a list operation. - :vartype value: list[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] - :ivar next_link: Link to the next set of results, if any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ConnectedPartnerResourcesListFormat]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.ConnectedPartnerResourcesListFormat"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Results of a list operation. - :paramtype value: list[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] - :keyword next_link: Link to the next set of results, if any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentInfoResponse(_serialization.Model): - """The properties of deployment in Elastic cloud corresponding to the Elastic monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The Elastic deployment status. Known values are: "Healthy" and "Unhealthy". - :vartype status: str or ~azure.mgmt.elastic.models.ElasticDeploymentStatus - :ivar version: Version of the elasticsearch in Elastic cloud deployment. - :vartype version: str - :ivar memory_capacity: RAM capacity of the elasticsearch in Elastic cloud deployment. - :vartype memory_capacity: str - :ivar disk_capacity: Disk capacity of the elasticsearch in Elastic cloud deployment. - :vartype disk_capacity: str - :ivar elasticsearch_end_point: Elasticsearch endpoint in Elastic cloud deployment. This is - either the aliased_endpoint if available, or the service_url otherwise. - :vartype elasticsearch_end_point: str - :ivar deployment_url: Deployment URL of the elasticsearch in Elastic cloud deployment. - :vartype deployment_url: str - :ivar marketplace_saas_info: Marketplace SaaS Info of the resource. - :vartype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo - :ivar project_type: Project Type - Applicable for Serverless only. - :vartype project_type: str - :ivar configuration_type: ConfigurationType Type - Applicable for Serverless only. - :vartype configuration_type: str - """ - - _validation = { - "status": {"readonly": True}, - "version": {"readonly": True}, - "memory_capacity": {"readonly": True}, - "disk_capacity": {"readonly": True}, - "elasticsearch_end_point": {"readonly": True}, - "deployment_url": {"readonly": True}, - "marketplace_saas_info": {"readonly": True}, - "project_type": {"readonly": True}, - "configuration_type": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "memory_capacity": {"key": "memoryCapacity", "type": "str"}, - "disk_capacity": {"key": "diskCapacity", "type": "str"}, - "elasticsearch_end_point": {"key": "elasticsearchEndPoint", "type": "str"}, - "deployment_url": {"key": "deploymentUrl", "type": "str"}, - "marketplace_saas_info": {"key": "marketplaceSaasInfo", "type": "MarketplaceSaaSInfo"}, - "project_type": {"key": "projectType", "type": "str"}, - "configuration_type": {"key": "configurationType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.ElasticDeploymentStatus"]] = None - self.version: Optional[str] = None - self.memory_capacity: Optional[str] = None - self.disk_capacity: Optional[str] = None - self.elasticsearch_end_point: Optional[str] = None - self.deployment_url: Optional[str] = None - self.marketplace_saas_info: Optional["_models.MarketplaceSaaSInfo"] = None - self.project_type: Optional[str] = None - self.configuration_type: Optional[str] = None - - -class ElasticCloudDeployment(_serialization.Model): - """Details of the user's elastic deployment associated with the monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Elastic deployment name. - :vartype name: str - :ivar deployment_id: Elastic deployment Id. - :vartype deployment_id: str - :ivar azure_subscription_id: Associated Azure subscription Id for the elastic deployment. - :vartype azure_subscription_id: str - :ivar elasticsearch_region: Region where Deployment at Elastic side took place. - :vartype elasticsearch_region: str - :ivar elasticsearch_service_url: Elasticsearch ingestion endpoint of the Elastic deployment. - :vartype elasticsearch_service_url: str - :ivar kibana_service_url: Kibana endpoint of the Elastic deployment. - :vartype kibana_service_url: str - :ivar kibana_sso_url: Kibana dashboard sso URL of the Elastic deployment. - :vartype kibana_sso_url: str - """ - - _validation = { - "name": {"readonly": True}, - "deployment_id": {"readonly": True}, - "azure_subscription_id": {"readonly": True}, - "elasticsearch_region": {"readonly": True}, - "elasticsearch_service_url": {"readonly": True}, - "kibana_service_url": {"readonly": True}, - "kibana_sso_url": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "deployment_id": {"key": "deploymentId", "type": "str"}, - "azure_subscription_id": {"key": "azureSubscriptionId", "type": "str"}, - "elasticsearch_region": {"key": "elasticsearchRegion", "type": "str"}, - "elasticsearch_service_url": {"key": "elasticsearchServiceUrl", "type": "str"}, - "kibana_service_url": {"key": "kibanaServiceUrl", "type": "str"}, - "kibana_sso_url": {"key": "kibanaSsoUrl", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.deployment_id: Optional[str] = None - self.azure_subscription_id: Optional[str] = None - self.elasticsearch_region: Optional[str] = None - self.elasticsearch_service_url: Optional[str] = None - self.kibana_service_url: Optional[str] = None - self.kibana_sso_url: Optional[str] = None - - -class ElasticCloudUser(_serialization.Model): - """Details of the user's elastic account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar email_address: Email of the Elastic User Account. - :vartype email_address: str - :ivar id: User Id of the elastic account of the User. - :vartype id: str - :ivar elastic_cloud_sso_default_url: Elastic cloud default dashboard sso URL of the Elastic - user account. - :vartype elastic_cloud_sso_default_url: str - """ - - _validation = { - "email_address": {"readonly": True}, - "id": {"readonly": True}, - "elastic_cloud_sso_default_url": {"readonly": True}, - } - - _attribute_map = { - "email_address": {"key": "emailAddress", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "elastic_cloud_sso_default_url": {"key": "elasticCloudSsoDefaultUrl", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.email_address: Optional[str] = None - self.id: Optional[str] = None - self.elastic_cloud_sso_default_url: Optional[str] = None - - -class ElasticMonitorResource(_serialization.Model): - """Monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: ARM id of the monitor resource. - :vartype id: str - :ivar name: Name of the monitor resource. - :vartype name: str - :ivar type: The type of the monitor resource. - :vartype type: str - :ivar kind: The kind of the Elastic resource - observability, security, search etc. - :vartype kind: str - :ivar sku: SKU of the monitor resource. - :vartype sku: ~azure.mgmt.elastic.models.ResourceSku - :ivar properties: Properties of the monitor resource. - :vartype properties: ~azure.mgmt.elastic.models.MonitorProperties - :ivar identity: Identity properties of the monitor resource. - :vartype identity: ~azure.mgmt.elastic.models.IdentityProperties - :ivar tags: The tags of the monitor resource. - :vartype tags: dict[str, str] - :ivar location: The location of the monitor resource. Required. - :vartype location: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.elastic.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "sku": {"key": "sku", "type": "ResourceSku"}, - "properties": {"key": "properties", "type": "MonitorProperties"}, - "identity": {"key": "identity", "type": "IdentityProperties"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, - *, - location: str, - kind: Optional[str] = None, - sku: Optional["_models.ResourceSku"] = None, - properties: Optional["_models.MonitorProperties"] = None, - identity: Optional["_models.IdentityProperties"] = None, - tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword kind: The kind of the Elastic resource - observability, security, search etc. - :paramtype kind: str - :keyword sku: SKU of the monitor resource. - :paramtype sku: ~azure.mgmt.elastic.models.ResourceSku - :keyword properties: Properties of the monitor resource. - :paramtype properties: ~azure.mgmt.elastic.models.MonitorProperties - :keyword identity: Identity properties of the monitor resource. - :paramtype identity: ~azure.mgmt.elastic.models.IdentityProperties - :keyword tags: The tags of the monitor resource. - :paramtype tags: dict[str, str] - :keyword location: The location of the monitor resource. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.kind = kind - self.sku = sku - self.properties = properties - self.identity = identity - self.tags = tags - self.location = location - self.system_data: Optional["_models.SystemData"] = None - - -class ElasticMonitorResourceListResponse(_serialization.Model): - """Response of a list operation. - - :ivar value: Results of a list operation. - :vartype value: list[~azure.mgmt.elastic.models.ElasticMonitorResource] - :ivar next_link: Link to the next set of results, if any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ElasticMonitorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.ElasticMonitorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Results of a list operation. - :paramtype value: list[~azure.mgmt.elastic.models.ElasticMonitorResource] - :keyword next_link: Link to the next set of results, if any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ElasticMonitorResourceUpdateParameters(_serialization.Model): - """Monitor resource update parameters. - - :ivar tags: elastic monitor resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: elastic monitor resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class ElasticMonitorUpgrade(_serialization.Model): - """Upgrade elastic monitor version. - - :ivar version: Version to which the elastic monitor should be upgraded to. - :vartype version: str - """ - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword version: Version to which the elastic monitor should be upgraded to. - :paramtype version: str - """ - super().__init__(**kwargs) - self.version = version - - -class ElasticOrganizationToAzureSubscriptionMappingResponse(_serialization.Model): # pylint: disable=name-too-long - """The Azure Subscription ID to which the Organization of the logged in user belongs and gets - billed into. - - :ivar properties: The properties of Azure Subscription ID to which the Organization of the - logged in user belongs and gets billed into. - :vartype properties: - ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ElasticOrganizationToAzureSubscriptionMappingResponseProperties"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of Azure Subscription ID to which the Organization of the - logged in user belongs and gets billed into. - :paramtype properties: - ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ElasticOrganizationToAzureSubscriptionMappingResponseProperties( - _serialization.Model -): # pylint: disable=name-too-long - """The properties of Azure Subscription ID to which the Organization of the logged in user belongs - and gets billed into. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar billed_azure_subscription_id: The Azure Subscription ID to which the Organization belongs - and gets billed into. This is empty for a new user OR a user without an Elastic Organization. - :vartype billed_azure_subscription_id: str - :ivar marketplace_saas_info: Marketplace SaaS Info of the resource. - :vartype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo - :ivar elastic_organization_id: The Elastic Organization Id. - :vartype elastic_organization_id: str - :ivar elastic_organization_name: The Elastic Organization Name. - :vartype elastic_organization_name: str - """ - - _validation = { - "marketplace_saas_info": {"readonly": True}, - } - - _attribute_map = { - "billed_azure_subscription_id": {"key": "billedAzureSubscriptionId", "type": "str"}, - "marketplace_saas_info": {"key": "marketplaceSaasInfo", "type": "MarketplaceSaaSInfo"}, - "elastic_organization_id": {"key": "elasticOrganizationId", "type": "str"}, - "elastic_organization_name": {"key": "elasticOrganizationName", "type": "str"}, - } - - def __init__( - self, - *, - billed_azure_subscription_id: Optional[str] = None, - elastic_organization_id: Optional[str] = None, - elastic_organization_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword billed_azure_subscription_id: The Azure Subscription ID to which the Organization - belongs and gets billed into. This is empty for a new user OR a user without an Elastic - Organization. - :paramtype billed_azure_subscription_id: str - :keyword elastic_organization_id: The Elastic Organization Id. - :paramtype elastic_organization_id: str - :keyword elastic_organization_name: The Elastic Organization Name. - :paramtype elastic_organization_name: str - """ - super().__init__(**kwargs) - self.billed_azure_subscription_id = billed_azure_subscription_id - self.marketplace_saas_info: Optional["_models.MarketplaceSaaSInfo"] = None - self.elastic_organization_id = elastic_organization_id - self.elastic_organization_name = elastic_organization_name - - -class ElasticProperties(_serialization.Model): - """Elastic Resource Properties. - - :ivar elastic_cloud_user: Details of the user's elastic account. - :vartype elastic_cloud_user: ~azure.mgmt.elastic.models.ElasticCloudUser - :ivar elastic_cloud_deployment: Details of the elastic cloud deployment. - :vartype elastic_cloud_deployment: ~azure.mgmt.elastic.models.ElasticCloudDeployment - """ - - _attribute_map = { - "elastic_cloud_user": {"key": "elasticCloudUser", "type": "ElasticCloudUser"}, - "elastic_cloud_deployment": {"key": "elasticCloudDeployment", "type": "ElasticCloudDeployment"}, - } - - def __init__( - self, - *, - elastic_cloud_user: Optional["_models.ElasticCloudUser"] = None, - elastic_cloud_deployment: Optional["_models.ElasticCloudDeployment"] = None, - **kwargs: Any - ) -> None: - """ - :keyword elastic_cloud_user: Details of the user's elastic account. - :paramtype elastic_cloud_user: ~azure.mgmt.elastic.models.ElasticCloudUser - :keyword elastic_cloud_deployment: Details of the elastic cloud deployment. - :paramtype elastic_cloud_deployment: ~azure.mgmt.elastic.models.ElasticCloudDeployment - """ - super().__init__(**kwargs) - self.elastic_cloud_user = elastic_cloud_user - self.elastic_cloud_deployment = elastic_cloud_deployment - - -class ElasticTrafficFilter(_serialization.Model): - """Elastic traffic filter object. - - :ivar id: Id of the elastic filter. - :vartype id: str - :ivar name: Name of the elastic filter. - :vartype name: str - :ivar description: Description of the elastic filter. - :vartype description: str - :ivar region: Region of the elastic filter. - :vartype region: str - :ivar type: Type of the elastic filter. Known values are: "ip" and "azure_private_endpoint". - :vartype type: str or ~azure.mgmt.elastic.models.Type - :ivar include_by_default: IncludeByDefault for the elastic filter. - :vartype include_by_default: bool - :ivar rules: Rules in the elastic filter. - :vartype rules: list[~azure.mgmt.elastic.models.ElasticTrafficFilterRule] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "region": {"key": "region", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "include_by_default": {"key": "includeByDefault", "type": "bool"}, - "rules": {"key": "rules", "type": "[ElasticTrafficFilterRule]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - description: Optional[str] = None, - region: Optional[str] = None, - type: Optional[Union[str, "_models.Type"]] = None, - include_by_default: Optional[bool] = None, - rules: Optional[list["_models.ElasticTrafficFilterRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the elastic filter. - :paramtype id: str - :keyword name: Name of the elastic filter. - :paramtype name: str - :keyword description: Description of the elastic filter. - :paramtype description: str - :keyword region: Region of the elastic filter. - :paramtype region: str - :keyword type: Type of the elastic filter. Known values are: "ip" and "azure_private_endpoint". - :paramtype type: str or ~azure.mgmt.elastic.models.Type - :keyword include_by_default: IncludeByDefault for the elastic filter. - :paramtype include_by_default: bool - :keyword rules: Rules in the elastic filter. - :paramtype rules: list[~azure.mgmt.elastic.models.ElasticTrafficFilterRule] - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.description = description - self.region = region - self.type = type - self.include_by_default = include_by_default - self.rules = rules - - -class ElasticTrafficFilterResponse(_serialization.Model): - """List of elastic traffic filters in the account. - - :ivar rulesets: List of elastic traffic filters in the account. - :vartype rulesets: list[~azure.mgmt.elastic.models.ElasticTrafficFilter] - """ - - _attribute_map = { - "rulesets": {"key": "rulesets", "type": "[ElasticTrafficFilter]"}, - } - - def __init__(self, *, rulesets: Optional[list["_models.ElasticTrafficFilter"]] = None, **kwargs: Any) -> None: - """ - :keyword rulesets: List of elastic traffic filters in the account. - :paramtype rulesets: list[~azure.mgmt.elastic.models.ElasticTrafficFilter] - """ - super().__init__(**kwargs) - self.rulesets = rulesets - - -class ElasticTrafficFilterRule(_serialization.Model): - """Elastic traffic filter rule object. - - :ivar source: IP of the elastic filter rule. - :vartype source: str - :ivar description: Description of the elastic filter rule. - :vartype description: str - :ivar azure_endpoint_guid: Guid of Private Endpoint in the elastic filter rule. - :vartype azure_endpoint_guid: str - :ivar azure_endpoint_name: Name of the Private Endpoint in the elastic filter rule. - :vartype azure_endpoint_name: str - :ivar id: Id of the elastic filter rule. - :vartype id: str - """ - - _attribute_map = { - "source": {"key": "source", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "azure_endpoint_guid": {"key": "azureEndpointGuid", "type": "str"}, - "azure_endpoint_name": {"key": "azureEndpointName", "type": "str"}, - "id": {"key": "id", "type": "str"}, - } - - def __init__( - self, - *, - source: Optional[str] = None, - description: Optional[str] = None, - azure_endpoint_guid: Optional[str] = None, - azure_endpoint_name: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :keyword source: IP of the elastic filter rule. - :paramtype source: str - :keyword description: Description of the elastic filter rule. - :paramtype description: str - :keyword azure_endpoint_guid: Guid of Private Endpoint in the elastic filter rule. - :paramtype azure_endpoint_guid: str - :keyword azure_endpoint_name: Name of the Private Endpoint in the elastic filter rule. - :paramtype azure_endpoint_name: str - :keyword id: Id of the elastic filter rule. - :paramtype id: str - """ - super().__init__(**kwargs) - self.source = source - self.description = description - self.azure_endpoint_guid = azure_endpoint_guid - self.azure_endpoint_name = azure_endpoint_name - self.id = id - - -class ElasticVersionListFormat(_serialization.Model): - """Elastic Version List Format. - - :ivar properties: Elastic Version Properties. - :vartype properties: ~azure.mgmt.elastic.models.ElasticVersionListProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ElasticVersionListProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ElasticVersionListProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Elastic Version Properties. - :paramtype properties: ~azure.mgmt.elastic.models.ElasticVersionListProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ElasticVersionListProperties(_serialization.Model): - """Elastic Version Properties. - - :ivar version: Available elastic version of the given region. - :vartype version: str - """ - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword version: Available elastic version of the given region. - :paramtype version: str - """ - super().__init__(**kwargs) - self.version = version - - -class ElasticVersionsListResponse(_serialization.Model): - """List of elastic versions available in a region. - - :ivar value: Results of a list operation. - :vartype value: list[~azure.mgmt.elastic.models.ElasticVersionListFormat] - :ivar next_link: Link to the next set of results, if any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ElasticVersionListFormat]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.ElasticVersionListFormat"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Results of a list operation. - :paramtype value: list[~azure.mgmt.elastic.models.ElasticVersionListFormat] - :keyword next_link: Link to the next set of results, if any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -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: Optional[str] = None - self.info: Optional[JSON] = 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.elastic.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.elastic.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: Optional[str] = None - self.message: Optional[str] = None - self.target: Optional[str] = None - self.details: Optional[list["_models.ErrorDetail"]] = None - self.additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = 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.elastic.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.elastic.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorResponseBody(_serialization.Model): - """Error response body. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message. - :vartype message: str - :ivar target: Error target. - :vartype target: str - :ivar details: Error details. - :vartype details: list[~azure.mgmt.elastic.models.ErrorResponseBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorResponseBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[list["_models.ErrorResponseBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message. - :paramtype message: str - :keyword target: Error target. - :paramtype target: str - :keyword details: Error details. - :paramtype details: list[~azure.mgmt.elastic.models.ErrorResponseBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ExternalUserCreationResponse(_serialization.Model): - """The properties of the response we got from elastic while creating external user. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created: Shows if user is created or updated. - :vartype created: bool - """ - - _validation = { - "created": {"readonly": True}, - } - - _attribute_map = { - "created": {"key": "created", "type": "bool"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.created: Optional[bool] = None - - -class ExternalUserInfo(_serialization.Model): - """The properties of the request required for creating user on elastic side. - - :ivar user_name: Username of the user to be created or updated. - :vartype user_name: str - :ivar full_name: Full name of the user to be created or updated. - :vartype full_name: str - :ivar password: Password of the user to be created or updated. - :vartype password: str - :ivar email_id: Email id of the user to be created or updated. - :vartype email_id: str - :ivar roles: Roles to be assigned for created or updated user. - :vartype roles: list[str] - """ - - _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, - "full_name": {"key": "fullName", "type": "str"}, - "password": {"key": "password", "type": "str"}, - "email_id": {"key": "emailId", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, - } - - def __init__( - self, - *, - user_name: Optional[str] = None, - full_name: Optional[str] = None, - password: Optional[str] = None, - email_id: Optional[str] = None, - roles: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword user_name: Username of the user to be created or updated. - :paramtype user_name: str - :keyword full_name: Full name of the user to be created or updated. - :paramtype full_name: str - :keyword password: Password of the user to be created or updated. - :paramtype password: str - :keyword email_id: Email id of the user to be created or updated. - :paramtype email_id: str - :keyword roles: Roles to be assigned for created or updated user. - :paramtype roles: list[str] - """ - super().__init__(**kwargs) - self.user_name = user_name - self.full_name = full_name - self.password = password - self.email_id = email_id - self.roles = roles - - -class FilteringTag(_serialization.Model): - """The definition of a filtering tag. Filtering tags are used for capturing resources and - include/exclude them from being monitored. - - :ivar name: The name (also known as the key) of the tag. - :vartype name: str - :ivar value: The value of the tag. - :vartype value: str - :ivar action: Valid actions for a filtering tag. Known values are: "Include" and "Exclude". - :vartype action: str or ~azure.mgmt.elastic.models.TagAction - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "action": {"key": "action", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - action: Optional[Union[str, "_models.TagAction"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name (also known as the key) of the tag. - :paramtype name: str - :keyword value: The value of the tag. - :paramtype value: str - :keyword action: Valid actions for a filtering tag. Known values are: "Include" and "Exclude". - :paramtype action: str or ~azure.mgmt.elastic.models.TagAction - """ - super().__init__(**kwargs) - self.name = name - self.value = value - self.action = action - - -class IdentityProperties(_serialization.Model): - """Identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The identity ID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: Managed identity type. "SystemAssigned" - :vartype type: str or ~azure.mgmt.elastic.models.ManagedIdentityTypes - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Optional[Union[str, "_models.ManagedIdentityTypes"]] = None, **kwargs: Any) -> None: - """ - :keyword type: Managed identity type. "SystemAssigned" - :paramtype type: str or ~azure.mgmt.elastic.models.ManagedIdentityTypes - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - - -class LogRules(_serialization.Model): - """Set of rules for sending logs for the Monitor resource. - - :ivar send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :vartype send_aad_logs: bool - :ivar send_subscription_logs: Flag specifying if subscription logs should be sent for the - Monitor resource. - :vartype send_subscription_logs: bool - :ivar send_activity_logs: Flag specifying if activity logs from Azure resources should be sent - for the Monitor resource. - :vartype send_activity_logs: bool - :ivar filtering_tags: List of filtering tags to be used for capturing logs. This only takes - effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only - Exclude action is specified, the rules will apply to the list of all available resources. If - Include actions are specified, the rules will only include resources with the associated tags. - :vartype filtering_tags: list[~azure.mgmt.elastic.models.FilteringTag] - """ - - _attribute_map = { - "send_aad_logs": {"key": "sendAadLogs", "type": "bool"}, - "send_subscription_logs": {"key": "sendSubscriptionLogs", "type": "bool"}, - "send_activity_logs": {"key": "sendActivityLogs", "type": "bool"}, - "filtering_tags": {"key": "filteringTags", "type": "[FilteringTag]"}, - } - - def __init__( - self, - *, - send_aad_logs: Optional[bool] = None, - send_subscription_logs: Optional[bool] = None, - send_activity_logs: Optional[bool] = None, - filtering_tags: Optional[list["_models.FilteringTag"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :paramtype send_aad_logs: bool - :keyword send_subscription_logs: Flag specifying if subscription logs should be sent for the - Monitor resource. - :paramtype send_subscription_logs: bool - :keyword send_activity_logs: Flag specifying if activity logs from Azure resources should be - sent for the Monitor resource. - :paramtype send_activity_logs: bool - :keyword filtering_tags: List of filtering tags to be used for capturing logs. This only takes - effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only - Exclude action is specified, the rules will apply to the list of all available resources. If - Include actions are specified, the rules will only include resources with the associated tags. - :paramtype filtering_tags: list[~azure.mgmt.elastic.models.FilteringTag] - """ - super().__init__(**kwargs) - self.send_aad_logs = send_aad_logs - self.send_subscription_logs = send_subscription_logs - self.send_activity_logs = send_activity_logs - self.filtering_tags = filtering_tags - - -class MarketplaceSaaSInfo(_serialization.Model): - """Marketplace SAAS Info of the resource. - - :ivar marketplace_subscription: Marketplace Subscription. - :vartype marketplace_subscription: - ~azure.mgmt.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription - :ivar marketplace_name: Marketplace Subscription Details: SAAS Name. - :vartype marketplace_name: str - :ivar marketplace_resource_id: Marketplace Subscription Details: Resource URI. - :vartype marketplace_resource_id: str - :ivar marketplace_status: Marketplace Subscription Details: SaaS Subscription Status. - :vartype marketplace_status: str - :ivar billed_azure_subscription_id: The Azure Subscription ID to which the Marketplace - Subscription belongs and gets billed into. - :vartype billed_azure_subscription_id: str - :ivar subscribed: Flag specifying if the Marketplace status is subscribed or not. - :vartype subscribed: bool - """ - - _attribute_map = { - "marketplace_subscription": { - "key": "marketplaceSubscription", - "type": "MarketplaceSaaSInfoMarketplaceSubscription", - }, - "marketplace_name": {"key": "marketplaceName", "type": "str"}, - "marketplace_resource_id": {"key": "marketplaceResourceId", "type": "str"}, - "marketplace_status": {"key": "marketplaceStatus", "type": "str"}, - "billed_azure_subscription_id": {"key": "billedAzureSubscriptionId", "type": "str"}, - "subscribed": {"key": "subscribed", "type": "bool"}, - } - - def __init__( - self, - *, - marketplace_subscription: Optional["_models.MarketplaceSaaSInfoMarketplaceSubscription"] = None, - marketplace_name: Optional[str] = None, - marketplace_resource_id: Optional[str] = None, - marketplace_status: Optional[str] = None, - billed_azure_subscription_id: Optional[str] = None, - subscribed: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword marketplace_subscription: Marketplace Subscription. - :paramtype marketplace_subscription: - ~azure.mgmt.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription - :keyword marketplace_name: Marketplace Subscription Details: SAAS Name. - :paramtype marketplace_name: str - :keyword marketplace_resource_id: Marketplace Subscription Details: Resource URI. - :paramtype marketplace_resource_id: str - :keyword marketplace_status: Marketplace Subscription Details: SaaS Subscription Status. - :paramtype marketplace_status: str - :keyword billed_azure_subscription_id: The Azure Subscription ID to which the Marketplace - Subscription belongs and gets billed into. - :paramtype billed_azure_subscription_id: str - :keyword subscribed: Flag specifying if the Marketplace status is subscribed or not. - :paramtype subscribed: bool - """ - super().__init__(**kwargs) - self.marketplace_subscription = marketplace_subscription - self.marketplace_name = marketplace_name - self.marketplace_resource_id = marketplace_resource_id - self.marketplace_status = marketplace_status - self.billed_azure_subscription_id = billed_azure_subscription_id - self.subscribed = subscribed - - -class MarketplaceSaaSInfoMarketplaceSubscription(_serialization.Model): # pylint: disable=name-too-long - """Marketplace Subscription. - - :ivar id: Marketplace Subscription Id. This is a GUID-formatted string. - :vartype id: str - :ivar publisher_id: Publisher Id of the Marketplace offer. - :vartype publisher_id: str - :ivar offer_id: Offer Id of the Marketplace offer,. - :vartype offer_id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "publisher_id": {"key": "publisherId", "type": "str"}, - "offer_id": {"key": "offerId", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - publisher_id: Optional[str] = None, - offer_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Marketplace Subscription Id. This is a GUID-formatted string. - :paramtype id: str - :keyword publisher_id: Publisher Id of the Marketplace offer. - :paramtype publisher_id: str - :keyword offer_id: Offer Id of the Marketplace offer,. - :paramtype offer_id: str - """ - super().__init__(**kwargs) - self.id = id - self.publisher_id = publisher_id - self.offer_id = offer_id - - -class MonitoredResource(_serialization.Model): - """The properties of a resource currently being monitored by the Elastic monitor resource. - - :ivar id: The ARM id of the resource. - :vartype id: str - :ivar sending_logs: Flag indicating the status of the resource for sending logs operation to - Elastic. Known values are: "True" and "False". - :vartype sending_logs: str or ~azure.mgmt.elastic.models.SendingLogs - :ivar reason_for_logs_status: Reason for why the resource is sending logs (or why it is not - sending). - :vartype reason_for_logs_status: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "sending_logs": {"key": "sendingLogs", "type": "str"}, - "reason_for_logs_status": {"key": "reasonForLogsStatus", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - sending_logs: Optional[Union[str, "_models.SendingLogs"]] = None, - reason_for_logs_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The ARM id of the resource. - :paramtype id: str - :keyword sending_logs: Flag indicating the status of the resource for sending logs operation to - Elastic. Known values are: "True" and "False". - :paramtype sending_logs: str or ~azure.mgmt.elastic.models.SendingLogs - :keyword reason_for_logs_status: Reason for why the resource is sending logs (or why it is not - sending). - :paramtype reason_for_logs_status: str - """ - super().__init__(**kwargs) - self.id = id - self.sending_logs = sending_logs - self.reason_for_logs_status = reason_for_logs_status - - -class MonitoredResourceListResponse(_serialization.Model): - """Response of a list operation. - - :ivar value: Results of a list operation. - :vartype value: list[~azure.mgmt.elastic.models.MonitoredResource] - :ivar next_link: Link to the next set of results, if any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MonitoredResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.MonitoredResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Results of a list operation. - :paramtype value: list[~azure.mgmt.elastic.models.MonitoredResource] - :keyword next_link: Link to the next set of results, if any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MonitoredSubscription(_serialization.Model): - """The list of subscriptions and it's monitoring status by current Elastic monitor. - - :ivar subscription_id: The subscriptionId to be monitored. - :vartype subscription_id: str - :ivar status: The state of monitoring. Known values are: "InProgress", "Active", "Failed", and - "Deleting". - :vartype status: str or ~azure.mgmt.elastic.models.Status - :ivar error: The reason of not monitoring the subscription. - :vartype error: str - :ivar tag_rules: Definition of the properties for a TagRules resource. - :vartype tag_rules: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties - """ - - _attribute_map = { - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "error": {"key": "error", "type": "str"}, - "tag_rules": {"key": "tagRules", "type": "MonitoringTagRulesProperties"}, - } - - def __init__( - self, - *, - subscription_id: Optional[str] = None, - status: Optional[Union[str, "_models.Status"]] = None, - error: Optional[str] = None, - tag_rules: Optional["_models.MonitoringTagRulesProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword subscription_id: The subscriptionId to be monitored. - :paramtype subscription_id: str - :keyword status: The state of monitoring. Known values are: "InProgress", "Active", "Failed", - and "Deleting". - :paramtype status: str or ~azure.mgmt.elastic.models.Status - :keyword error: The reason of not monitoring the subscription. - :paramtype error: str - :keyword tag_rules: Definition of the properties for a TagRules resource. - :paramtype tag_rules: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties - """ - super().__init__(**kwargs) - self.subscription_id = subscription_id - self.status = status - self.error = error - self.tag_rules = tag_rules - - -class MonitoredSubscriptionProperties(_serialization.Model): - """The request to update subscriptions needed to be monitored by the Elastic monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the monitored subscription resource. - :vartype name: str - :ivar id: The id of the monitored subscription resource. - :vartype id: str - :ivar type: The type of the monitored subscription resource. - :vartype type: str - :ivar properties: The request to update subscriptions needed to be monitored by the Elastic - monitor resource. - :vartype properties: ~azure.mgmt.elastic.models.SubscriptionList - """ - - _validation = { - "name": {"readonly": True}, - "id": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "SubscriptionList"}, - } - - def __init__(self, *, properties: Optional["_models.SubscriptionList"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The request to update subscriptions needed to be monitored by the Elastic - monitor resource. - :paramtype properties: ~azure.mgmt.elastic.models.SubscriptionList - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.id: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - - -class MonitoredSubscriptionPropertiesList(_serialization.Model): - """MonitoredSubscriptionPropertiesList. - - :ivar value: - :vartype value: list[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MonitoredSubscriptionProperties]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.MonitoredSubscriptionProperties"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MonitoringTagRules(_serialization.Model): - """Capture logs and metrics of Azure resources based on ARM tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the rule set. - :vartype name: str - :ivar id: The id of the rule set. - :vartype id: str - :ivar type: The type of the rule set. - :vartype type: str - :ivar properties: Properties of the monitoring tag rules. - :vartype properties: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.elastic.models.SystemData - """ - - _validation = { - "name": {"readonly": True}, - "id": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "MonitoringTagRulesProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, *, properties: Optional["_models.MonitoringTagRulesProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the monitoring tag rules. - :paramtype properties: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.id: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - self.system_data: Optional["_models.SystemData"] = None - - -class MonitoringTagRulesListResponse(_serialization.Model): - """Response of a list operation. - - :ivar value: Results of a list operation. - :vartype value: list[~azure.mgmt.elastic.models.MonitoringTagRules] - :ivar next_link: Link to the next set of results, if any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MonitoringTagRules]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.MonitoringTagRules"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Results of a list operation. - :paramtype value: list[~azure.mgmt.elastic.models.MonitoringTagRules] - :keyword next_link: Link to the next set of results, if any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MonitoringTagRulesProperties(_serialization.Model): - """Definition of the properties for a TagRules resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the monitoring tag rules. Known values are: - "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", - and "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState - :ivar log_rules: Rules for sending logs. - :vartype log_rules: ~azure.mgmt.elastic.models.LogRules - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "log_rules": {"key": "logRules", "type": "LogRules"}, - } - - def __init__(self, *, log_rules: Optional["_models.LogRules"] = None, **kwargs: Any) -> None: - """ - :keyword log_rules: Rules for sending logs. - :paramtype log_rules: ~azure.mgmt.elastic.models.LogRules - """ - super().__init__(**kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.log_rules = log_rules - - -class MonitorProperties(_serialization.Model): - """Properties specific to the monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the monitor resource. Known values are: - "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", - and "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState - :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Known values are: "Enabled" and "Disabled". - :vartype monitoring_status: str or ~azure.mgmt.elastic.models.MonitoringStatus - :ivar elastic_properties: Elastic cloud properties. - :vartype elastic_properties: ~azure.mgmt.elastic.models.ElasticProperties - :ivar user_info: User information. - :vartype user_info: ~azure.mgmt.elastic.models.UserInfo - :ivar plan_details: Plan details of the monitor resource. - :vartype plan_details: ~azure.mgmt.elastic.models.PlanDetails - :ivar version: Version of elastic of the monitor resource. - :vartype version: str - :ivar subscription_state: State of the Azure Subscription containing the monitor resource. - :vartype subscription_state: str - :ivar saa_s_azure_subscription_status: Status of Azure Subscription where Marketplace SaaS is - located. - :vartype saa_s_azure_subscription_status: str - :ivar source_campaign_name: Name of the marketing campaign. - :vartype source_campaign_name: str - :ivar source_campaign_id: A unique identifier associated with the campaign. - :vartype source_campaign_id: str - :ivar liftr_resource_category: Known values are: "Unknown" and "MonitorLogs". - :vartype liftr_resource_category: str or ~azure.mgmt.elastic.models.LiftrResourceCategories - :ivar liftr_resource_preference: The priority of the resource. - :vartype liftr_resource_preference: int - :ivar generate_api_key: Flag to determine if User API Key has to be generated and shared. - :vartype generate_api_key: bool - :ivar hosting_type: Hosting type of the monitor resource - either Hosted deployments OR - Serverless Projects. Known values are: "Hosted" and "Serverless". - :vartype hosting_type: str or ~azure.mgmt.elastic.models.HostingType - :ivar project_details: Project details of the monitor resource IF it belongs to Serverless - offer kind. - :vartype project_details: ~azure.mgmt.elastic.models.ProjectDetails - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "liftr_resource_category": {"readonly": True}, - "liftr_resource_preference": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "monitoring_status": {"key": "monitoringStatus", "type": "str"}, - "elastic_properties": {"key": "elasticProperties", "type": "ElasticProperties"}, - "user_info": {"key": "userInfo", "type": "UserInfo"}, - "plan_details": {"key": "planDetails", "type": "PlanDetails"}, - "version": {"key": "version", "type": "str"}, - "subscription_state": {"key": "subscriptionState", "type": "str"}, - "saa_s_azure_subscription_status": {"key": "saaSAzureSubscriptionStatus", "type": "str"}, - "source_campaign_name": {"key": "sourceCampaignName", "type": "str"}, - "source_campaign_id": {"key": "sourceCampaignId", "type": "str"}, - "liftr_resource_category": {"key": "liftrResourceCategory", "type": "str"}, - "liftr_resource_preference": {"key": "liftrResourcePreference", "type": "int"}, - "generate_api_key": {"key": "generateApiKey", "type": "bool"}, - "hosting_type": {"key": "hostingType", "type": "str"}, - "project_details": {"key": "projectDetails", "type": "ProjectDetails"}, - } - - def __init__( - self, - *, - monitoring_status: Optional[Union[str, "_models.MonitoringStatus"]] = None, - elastic_properties: Optional["_models.ElasticProperties"] = None, - user_info: Optional["_models.UserInfo"] = None, - plan_details: Optional["_models.PlanDetails"] = None, - version: Optional[str] = None, - subscription_state: Optional[str] = None, - saa_s_azure_subscription_status: Optional[str] = None, - source_campaign_name: Optional[str] = None, - source_campaign_id: Optional[str] = None, - generate_api_key: Optional[bool] = None, - hosting_type: Optional[Union[str, "_models.HostingType"]] = None, - project_details: Optional["_models.ProjectDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Known values are: "Enabled" and "Disabled". - :paramtype monitoring_status: str or ~azure.mgmt.elastic.models.MonitoringStatus - :keyword elastic_properties: Elastic cloud properties. - :paramtype elastic_properties: ~azure.mgmt.elastic.models.ElasticProperties - :keyword user_info: User information. - :paramtype user_info: ~azure.mgmt.elastic.models.UserInfo - :keyword plan_details: Plan details of the monitor resource. - :paramtype plan_details: ~azure.mgmt.elastic.models.PlanDetails - :keyword version: Version of elastic of the monitor resource. - :paramtype version: str - :keyword subscription_state: State of the Azure Subscription containing the monitor resource. - :paramtype subscription_state: str - :keyword saa_s_azure_subscription_status: Status of Azure Subscription where Marketplace SaaS - is located. - :paramtype saa_s_azure_subscription_status: str - :keyword source_campaign_name: Name of the marketing campaign. - :paramtype source_campaign_name: str - :keyword source_campaign_id: A unique identifier associated with the campaign. - :paramtype source_campaign_id: str - :keyword generate_api_key: Flag to determine if User API Key has to be generated and shared. - :paramtype generate_api_key: bool - :keyword hosting_type: Hosting type of the monitor resource - either Hosted deployments OR - Serverless Projects. Known values are: "Hosted" and "Serverless". - :paramtype hosting_type: str or ~azure.mgmt.elastic.models.HostingType - :keyword project_details: Project details of the monitor resource IF it belongs to Serverless - offer kind. - :paramtype project_details: ~azure.mgmt.elastic.models.ProjectDetails - """ - super().__init__(**kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.monitoring_status = monitoring_status - self.elastic_properties = elastic_properties - self.user_info = user_info - self.plan_details = plan_details - self.version = version - self.subscription_state = subscription_state - self.saa_s_azure_subscription_status = saa_s_azure_subscription_status - self.source_campaign_name = source_campaign_name - self.source_campaign_id = source_campaign_id - self.liftr_resource_category: Optional[Union[str, "_models.LiftrResourceCategories"]] = None - self.liftr_resource_preference: Optional[int] = None - self.generate_api_key = generate_api_key - self.hosting_type = hosting_type - self.project_details = project_details - - -class OpenAIIntegrationProperties(_serialization.Model): - """Open AI Integration details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar open_ai_resource_id: The resource name of Open AI resource. - :vartype open_ai_resource_id: str - :ivar open_ai_resource_endpoint: The API endpoint for Open AI resource. - :vartype open_ai_resource_endpoint: str - :ivar open_ai_connector_id: The connector id of Open AI resource. - :vartype open_ai_connector_id: str - :ivar key: Value of API key for Open AI resource. - :vartype key: str - :ivar last_refresh_at: Last Update Timestamp for key updation. - :vartype last_refresh_at: ~datetime.datetime - """ - - _validation = { - "last_refresh_at": {"readonly": True}, - } - - _attribute_map = { - "open_ai_resource_id": {"key": "openAIResourceId", "type": "str"}, - "open_ai_resource_endpoint": {"key": "openAIResourceEndpoint", "type": "str"}, - "open_ai_connector_id": {"key": "openAIConnectorId", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "last_refresh_at": {"key": "lastRefreshAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - open_ai_resource_id: Optional[str] = None, - open_ai_resource_endpoint: Optional[str] = None, - open_ai_connector_id: Optional[str] = None, - key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword open_ai_resource_id: The resource name of Open AI resource. - :paramtype open_ai_resource_id: str - :keyword open_ai_resource_endpoint: The API endpoint for Open AI resource. - :paramtype open_ai_resource_endpoint: str - :keyword open_ai_connector_id: The connector id of Open AI resource. - :paramtype open_ai_connector_id: str - :keyword key: Value of API key for Open AI resource. - :paramtype key: str - """ - super().__init__(**kwargs) - self.open_ai_resource_id = open_ai_resource_id - self.open_ai_resource_endpoint = open_ai_resource_endpoint - self.open_ai_connector_id = open_ai_connector_id - self.key = key - self.last_refresh_at: Optional[datetime.datetime] = None - - -class OpenAIIntegrationRPModel(_serialization.Model): - """Capture properties of Open AI resource Integration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the integration. - :vartype name: str - :ivar id: The id of the integration. - :vartype id: str - :ivar type: The type of the integration. - :vartype type: str - :ivar properties: Open AI Integration details. - :vartype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationProperties - """ - - _validation = { - "name": {"readonly": True}, - "id": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "OpenAIIntegrationProperties"}, - } - - def __init__(self, *, properties: Optional["_models.OpenAIIntegrationProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Open AI Integration details. - :paramtype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationProperties - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.id: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - - -class OpenAIIntegrationRPModelListResponse(_serialization.Model): - """Response of a list operation. - - :ivar value: Results of a list operation. - :vartype value: list[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] - :ivar next_link: Link to the next set of results, if any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenAIIntegrationRPModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.OpenAIIntegrationRPModel"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Results of a list operation. - :paramtype value: list[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] - :keyword next_link: Link to the next set of results, if any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OpenAIIntegrationStatusResponse(_serialization.Model): - """Status of the OpenAI Integration. - - :ivar properties: Status of the OpenAI Integration. - :vartype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponseProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "OpenAIIntegrationStatusResponseProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.OpenAIIntegrationStatusResponseProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Status of the OpenAI Integration. - :paramtype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponseProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class OpenAIIntegrationStatusResponseProperties(_serialization.Model): # pylint: disable=name-too-long - """Status of the OpenAI Integration. - - :ivar status: Status of the OpenAI Integration. - :vartype status: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, status: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword status: Status of the OpenAI Integration. - :paramtype status: str - """ - super().__init__(**kwargs) - self.status = status - - -class OperationDisplay(_serialization.Model): - """The object that represents the operation. - - :ivar provider: Service provider, i.e., Microsoft.Elastic. - :vartype provider: str - :ivar resource: Type on which the operation is performed, e.g., 'monitors'. - :vartype resource: str - :ivar operation: Operation type, e.g., read, write, delete, etc. - :vartype operation: str - :ivar description: Description of the operation, e.g., 'Write monitors'. - :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: Service provider, i.e., Microsoft.Elastic. - :paramtype provider: str - :keyword resource: Type on which the operation is performed, e.g., 'monitors'. - :paramtype resource: str - :keyword operation: Operation type, e.g., read, write, delete, etc. - :paramtype operation: str - :keyword description: Description of the operation, e.g., 'Write monitors'. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationListResult(_serialization.Model): - """Result of GET request to list the Microsoft.Elastic operations. - - :ivar value: List of operations supported by the Microsoft.Elastic provider. - :vartype value: list[~azure.mgmt.elastic.models.OperationResult] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationResult]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.OperationResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of operations supported by the Microsoft.Elastic provider. - :paramtype value: list[~azure.mgmt.elastic.models.OperationResult] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OperationResult(_serialization.Model): - """A Microsoft.Elastic REST API operation. - - :ivar name: Operation name, i.e., {provider}/{resource}/{operation}. - :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.elastic.models.OperationDisplay - :ivar origin: Origin of the operation. - :vartype origin: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name, i.e., {provider}/{resource}/{operation}. - :paramtype name: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.elastic.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - """ - super().__init__(**kwargs) - self.name = name - self.is_data_action = is_data_action - self.display = display - self.origin = origin - - -class PartnerBillingEntity(_serialization.Model): - """Partner Billing details associated with the resource. - - :ivar id: The Elastic Organization Id. - :vartype id: str - :ivar name: The Elastic Organization Name. - :vartype name: str - :ivar partner_entity_uri: Link to the elastic organization page. - :vartype partner_entity_uri: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "partner_entity_uri": {"key": "partnerEntityUri", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - partner_entity_uri: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The Elastic Organization Id. - :paramtype id: str - :keyword name: The Elastic Organization Name. - :paramtype name: str - :keyword partner_entity_uri: Link to the elastic organization page. - :paramtype partner_entity_uri: str - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.partner_entity_uri = partner_entity_uri - - -class PlanDetails(_serialization.Model): - """Plan details of the monitor resource. - - :ivar offer_id: Offer ID of the plan. - :vartype offer_id: str - :ivar publisher_id: Publisher ID of the plan. - :vartype publisher_id: str - :ivar term_id: Term ID of the plan. - :vartype term_id: str - :ivar plan_id: Plan ID. - :vartype plan_id: str - :ivar plan_name: Plan Name. - :vartype plan_name: str - """ - - _attribute_map = { - "offer_id": {"key": "offerID", "type": "str"}, - "publisher_id": {"key": "publisherID", "type": "str"}, - "term_id": {"key": "termID", "type": "str"}, - "plan_id": {"key": "planID", "type": "str"}, - "plan_name": {"key": "planName", "type": "str"}, - } - - def __init__( - self, - *, - offer_id: Optional[str] = None, - publisher_id: Optional[str] = None, - term_id: Optional[str] = None, - plan_id: Optional[str] = None, - plan_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword offer_id: Offer ID of the plan. - :paramtype offer_id: str - :keyword publisher_id: Publisher ID of the plan. - :paramtype publisher_id: str - :keyword term_id: Term ID of the plan. - :paramtype term_id: str - :keyword plan_id: Plan ID. - :paramtype plan_id: str - :keyword plan_name: Plan Name. - :paramtype plan_name: str - """ - super().__init__(**kwargs) - self.offer_id = offer_id - self.publisher_id = publisher_id - self.term_id = term_id - self.plan_id = plan_id - self.plan_name = plan_name - - -class ProjectDetails(_serialization.Model): - """Project details of the monitor resource IF it belongs to Serverless offer kind. - - :ivar project_type: Project type; ex: Elasticsearch / Observability / Security. Known values - are: "Elasticsearch", "Observability", "Security", and "NotApplicable". - :vartype project_type: str or ~azure.mgmt.elastic.models.ProjectType - :ivar configuration_type: Configuration type of the Elasticsearch project. Known values are: - "GeneralPurpose", "Vector", "TimeSeries", and "NotApplicable". - :vartype configuration_type: str or ~azure.mgmt.elastic.models.ConfigurationType - """ - - _attribute_map = { - "project_type": {"key": "projectType", "type": "str"}, - "configuration_type": {"key": "configurationType", "type": "str"}, - } - - def __init__( - self, - *, - project_type: Optional[Union[str, "_models.ProjectType"]] = None, - configuration_type: Optional[Union[str, "_models.ConfigurationType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword project_type: Project type; ex: Elasticsearch / Observability / Security. Known values - are: "Elasticsearch", "Observability", "Security", and "NotApplicable". - :paramtype project_type: str or ~azure.mgmt.elastic.models.ProjectType - :keyword configuration_type: Configuration type of the Elasticsearch project. Known values are: - "GeneralPurpose", "Vector", "TimeSeries", and "NotApplicable". - :paramtype configuration_type: str or ~azure.mgmt.elastic.models.ConfigurationType - """ - super().__init__(**kwargs) - self.project_type = project_type - self.configuration_type = configuration_type - - -class ResourceProviderDefaultErrorResponse(_serialization.Model): - """RP default error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Response body of Error. - :vartype error: ~azure.mgmt.elastic.models.ErrorResponseBody - """ - - _validation = { - "error": {"readonly": True}, - } - - _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseBody"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error: Optional["_models.ErrorResponseBody"] = None - - -class ResourceSku(_serialization.Model): - """Microsoft.Elastic SKU. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the SKU. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name of the SKU. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class ResubscribeProperties(_serialization.Model): - """Resubscribe Properties. - - :ivar plan_id: Newly selected plan Id to create the new Marketplace subscription for - Resubscribe. - :vartype plan_id: str - :ivar term: Newly selected term to create the new Marketplace subscription for Resubscribe. - :vartype term: str - :ivar subscription_id: Newly selected Azure Subscription Id in which the new Marketplace - subscription will be created for Resubscribe. - :vartype subscription_id: str - :ivar resource_group: Newly selected Azure resource group in which the new Marketplace - subscription will be created for Resubscribe. - :vartype resource_group: str - :ivar organization_id: Organization Id of the Elastic Organization that needs to be - resubscribed. - :vartype organization_id: str - """ - - _attribute_map = { - "plan_id": {"key": "planId", "type": "str"}, - "term": {"key": "term", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "resource_group": {"key": "resourceGroup", "type": "str"}, - "organization_id": {"key": "organizationId", "type": "str"}, - } - - def __init__( - self, - *, - plan_id: Optional[str] = None, - term: Optional[str] = None, - subscription_id: Optional[str] = None, - resource_group: Optional[str] = None, - organization_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan_id: Newly selected plan Id to create the new Marketplace subscription for - Resubscribe. - :paramtype plan_id: str - :keyword term: Newly selected term to create the new Marketplace subscription for Resubscribe. - :paramtype term: str - :keyword subscription_id: Newly selected Azure Subscription Id in which the new Marketplace - subscription will be created for Resubscribe. - :paramtype subscription_id: str - :keyword resource_group: Newly selected Azure resource group in which the new Marketplace - subscription will be created for Resubscribe. - :paramtype resource_group: str - :keyword organization_id: Organization Id of the Elastic Organization that needs to be - resubscribed. - :paramtype organization_id: str - """ - super().__init__(**kwargs) - self.plan_id = plan_id - self.term = term - self.subscription_id = subscription_id - self.resource_group = resource_group - self.organization_id = organization_id - - -class SubscriptionList(_serialization.Model): - """The request to update subscriptions needed to be monitored by the Elastic monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation: The operation for the patch on the resource. Known values are: "AddBegin", - "AddComplete", "DeleteBegin", "DeleteComplete", and "Active". - :vartype operation: str or ~azure.mgmt.elastic.models.Operation - :ivar monitored_subscription_list: List of subscriptions and the state of the monitoring. - :vartype monitored_subscription_list: list[~azure.mgmt.elastic.models.MonitoredSubscription] - :ivar provisioning_state: Provisioning State of the resource. Known values are: "Accepted", - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and - "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "operation": {"key": "operation", "type": "str"}, - "monitored_subscription_list": {"key": "monitoredSubscriptionList", "type": "[MonitoredSubscription]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - operation: Optional[Union[str, "_models.Operation"]] = None, - monitored_subscription_list: Optional[list["_models.MonitoredSubscription"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword operation: The operation for the patch on the resource. Known values are: "AddBegin", - "AddComplete", "DeleteBegin", "DeleteComplete", and "Active". - :paramtype operation: str or ~azure.mgmt.elastic.models.Operation - :keyword monitored_subscription_list: List of subscriptions and the state of the monitoring. - :paramtype monitored_subscription_list: list[~azure.mgmt.elastic.models.MonitoredSubscription] - """ - super().__init__(**kwargs) - self.operation = operation - self.monitored_subscription_list = monitored_subscription_list - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.elastic.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.elastic.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.elastic.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.elastic.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class UpgradableVersionsList(_serialization.Model): - """Stack Versions that this version can upgrade to. - - :ivar current_version: Current version of the elastic monitor. - :vartype current_version: str - :ivar upgradable_versions: Stack Versions that this version can upgrade to. - :vartype upgradable_versions: list[str] - """ - - _attribute_map = { - "current_version": {"key": "currentVersion", "type": "str"}, - "upgradable_versions": {"key": "upgradableVersions", "type": "[str]"}, - } - - def __init__( - self, *, current_version: Optional[str] = None, upgradable_versions: Optional[list[str]] = None, **kwargs: Any - ) -> None: - """ - :keyword current_version: Current version of the elastic monitor. - :paramtype current_version: str - :keyword upgradable_versions: Stack Versions that this version can upgrade to. - :paramtype upgradable_versions: list[str] - """ - super().__init__(**kwargs) - self.current_version = current_version - self.upgradable_versions = upgradable_versions - - -class UserApiKeyResponse(_serialization.Model): - """The User Api Key created for the Organization associated with the User Email Id that was passed - in the request. - - :ivar properties: - :vartype properties: ~azure.mgmt.elastic.models.UserApiKeyResponseProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "UserApiKeyResponseProperties"}, - } - - def __init__(self, *, properties: Optional["_models.UserApiKeyResponseProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: - :paramtype properties: ~azure.mgmt.elastic.models.UserApiKeyResponseProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UserApiKeyResponseProperties(_serialization.Model): - """UserApiKeyResponseProperties. - - :ivar api_key: The User Api Key Generated based on GenerateApiKey flag. This is applicable for - non-Portal clients only. - :vartype api_key: str - """ - - _attribute_map = { - "api_key": {"key": "apiKey", "type": "str"}, - } - - def __init__(self, *, api_key: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword api_key: The User Api Key Generated based on GenerateApiKey flag. This is applicable - for non-Portal clients only. - :paramtype api_key: str - """ - super().__init__(**kwargs) - self.api_key = api_key - - -class UserEmailId(_serialization.Model): - """Email Id of the User Organization, of which the API Key must be returned. - - :ivar email_id: The User email Id. - :vartype email_id: str - """ - - _attribute_map = { - "email_id": {"key": "emailId", "type": "str"}, - } - - def __init__(self, *, email_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword email_id: The User email Id. - :paramtype email_id: str - """ - super().__init__(**kwargs) - self.email_id = email_id - - -class UserInfo(_serialization.Model): - """User Information to be passed to partners. - - :ivar first_name: First name of the user. - :vartype first_name: str - :ivar last_name: Last name of the user. - :vartype last_name: str - :ivar company_name: Company name of the user. - :vartype company_name: str - :ivar email_address: Email of the user used by Elastic for contacting them if needed. - :vartype email_address: str - :ivar company_info: Company information of the user to be passed to partners. - :vartype company_info: ~azure.mgmt.elastic.models.CompanyInfo - """ - - _validation = { - "first_name": {"max_length": 128}, - "last_name": {"max_length": 128}, - "company_name": {"max_length": 128}, - "email_address": { - "pattern": r'^([^<>()\[\]\.,;:\s@"]+(\.[^<>()\[\]\.,;:\s@"]+)*)@(([a-zA-Z-_0-9]+\.)+[a-zA-Z]{2,})$' - }, - } - - _attribute_map = { - "first_name": {"key": "firstName", "type": "str"}, - "last_name": {"key": "lastName", "type": "str"}, - "company_name": {"key": "companyName", "type": "str"}, - "email_address": {"key": "emailAddress", "type": "str"}, - "company_info": {"key": "companyInfo", "type": "CompanyInfo"}, - } - - def __init__( - self, - *, - first_name: Optional[str] = None, - last_name: Optional[str] = None, - company_name: Optional[str] = None, - email_address: Optional[str] = None, - company_info: Optional["_models.CompanyInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword first_name: First name of the user. - :paramtype first_name: str - :keyword last_name: Last name of the user. - :paramtype last_name: str - :keyword company_name: Company name of the user. - :paramtype company_name: str - :keyword email_address: Email of the user used by Elastic for contacting them if needed. - :paramtype email_address: str - :keyword company_info: Company information of the user to be passed to partners. - :paramtype company_info: ~azure.mgmt.elastic.models.CompanyInfo - """ - super().__init__(**kwargs) - self.first_name = first_name - self.last_name = last_name - self.company_name = company_name - self.email_address = email_address - self.company_info = company_info - - -class VMCollectionUpdate(_serialization.Model): - """Update VM resource collection. - - :ivar vm_resource_id: ARM id of the VM resource. - :vartype vm_resource_id: str - :ivar operation_name: Operation to be performed for given VM. Known values are: "Add" and - "Delete". - :vartype operation_name: str or ~azure.mgmt.elastic.models.OperationName - """ - - _attribute_map = { - "vm_resource_id": {"key": "vmResourceId", "type": "str"}, - "operation_name": {"key": "operationName", "type": "str"}, - } - - def __init__( - self, - *, - vm_resource_id: Optional[str] = None, - operation_name: Optional[Union[str, "_models.OperationName"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_resource_id: ARM id of the VM resource. - :paramtype vm_resource_id: str - :keyword operation_name: Operation to be performed for given VM. Known values are: "Add" and - "Delete". - :paramtype operation_name: str or ~azure.mgmt.elastic.models.OperationName - """ - super().__init__(**kwargs) - self.vm_resource_id = vm_resource_id - self.operation_name = operation_name - - -class VMHostListResponse(_serialization.Model): - """Response of a list operation. - - :ivar value: Results of a list operation. - :vartype value: list[~azure.mgmt.elastic.models.VMResources] - :ivar next_link: Link to the next Vm resource Id, if any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VMResources]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.VMResources"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Results of a list operation. - :paramtype value: list[~azure.mgmt.elastic.models.VMResources] - :keyword next_link: Link to the next Vm resource Id, if any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VMIngestionDetailsResponse(_serialization.Model): - """The vm ingestion details to install an agent. - - :ivar cloud_id: The cloudId of given Elastic monitor resource. - :vartype cloud_id: str - :ivar ingestion_key: Ingestion details to install agent on given VM. - :vartype ingestion_key: str - """ - - _attribute_map = { - "cloud_id": {"key": "cloudId", "type": "str"}, - "ingestion_key": {"key": "ingestionKey", "type": "str"}, - } - - def __init__(self, *, cloud_id: Optional[str] = None, ingestion_key: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword cloud_id: The cloudId of given Elastic monitor resource. - :paramtype cloud_id: str - :keyword ingestion_key: Ingestion details to install agent on given VM. - :paramtype ingestion_key: str - """ - super().__init__(**kwargs) - self.cloud_id = cloud_id - self.ingestion_key = ingestion_key - - -class VMResources(_serialization.Model): - """The vm resource properties that is currently being monitored by the Elastic monitor resource. - - :ivar vm_resource_id: The ARM id of the VM resource. - :vartype vm_resource_id: str - """ - - _attribute_map = { - "vm_resource_id": {"key": "vmResourceId", "type": "str"}, - } - - def __init__(self, *, vm_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword vm_resource_id: The ARM id of the VM resource. - :paramtype vm_resource_id: str - """ - super().__init__(**kwargs) - self.vm_resource_id = vm_resource_id diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_patch.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_patch.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# 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 """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py index d920cd5fb72c..829239b82bd0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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 @@ -13,30 +13,30 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._monitors_operations import MonitorsOperations # type: ignore -from ._elastic_versions_operations import ElasticVersionsOperations # type: ignore -from ._monitored_subscriptions_operations import MonitoredSubscriptionsOperations # type: ignore -from ._monitored_resources_operations import MonitoredResourcesOperations # type: ignore -from ._deployment_info_operations import DeploymentInfoOperations # type: ignore -from ._external_user_operations import ExternalUserOperations # type: ignore -from ._billing_info_operations import BillingInfoOperations # type: ignore -from ._connected_partner_resources_operations import ConnectedPartnerResourcesOperations # type: ignore -from ._open_ai_operations import OpenAIOperations # type: ignore -from ._tag_rules_operations import TagRulesOperations # type: ignore -from ._vm_host_operations import VMHostOperations # type: ignore -from ._vm_ingestion_operations import VMIngestionOperations # type: ignore -from ._vm_collection_operations import VMCollectionOperations # type: ignore -from ._upgradable_versions_operations import UpgradableVersionsOperations # type: ignore -from ._monitor_operations import MonitorOperations # type: ignore -from ._all_traffic_filters_operations import AllTrafficFiltersOperations # type: ignore -from ._list_associated_traffic_filters_operations import ListAssociatedTrafficFiltersOperations # type: ignore -from ._create_and_associate_ip_filter_operations import CreateAndAssociateIPFilterOperations # type: ignore -from ._create_and_associate_pl_filter_operations import CreateAndAssociatePLFilterOperations # type: ignore -from ._associate_traffic_filter_operations import AssociateTrafficFilterOperations # type: ignore -from ._detach_and_delete_traffic_filter_operations import DetachAndDeleteTrafficFilterOperations # type: ignore -from ._detach_traffic_filter_operations import DetachTrafficFilterOperations # type: ignore -from ._traffic_filters_operations import TrafficFiltersOperations # type: ignore -from ._organizations_operations import OrganizationsOperations # type: ignore +from ._operations import MonitoredSubscriptionsOperations # type: ignore +from ._operations import TagRulesOperations # type: ignore +from ._operations import MonitorsOperations # type: ignore +from ._operations import MonitoredResourcesOperations # type: ignore +from ._operations import DeploymentInfoOperations # type: ignore +from ._operations import ExternalUserOperations # type: ignore +from ._operations import BillingInfoOperations # type: ignore +from ._operations import ConnectedPartnerResourcesOperations # type: ignore +from ._operations import VMHostOperations # type: ignore +from ._operations import VMIngestionOperations # type: ignore +from ._operations import VMCollectionOperations # type: ignore +from ._operations import UpgradableVersionsOperations # type: ignore +from ._operations import MonitorOperations # type: ignore +from ._operations import AllTrafficFiltersOperations # type: ignore +from ._operations import listAssociatedTrafficFiltersOperations # type: ignore +from ._operations import createAndAssociateIPFilterOperations # type: ignore +from ._operations import createAndAssociatePLFilterOperations # type: ignore +from ._operations import AssociateTrafficFilterOperations # type: ignore +from ._operations import DetachAndDeleteTrafficFilterOperations # type: ignore +from ._operations import DetachTrafficFilterOperations # type: ignore +from ._operations import TrafficFiltersOperations # type: ignore +from ._operations import OrganizationsOperations # type: ignore +from ._operations import OpenAIOperations # type: ignore +from ._operations import ElasticVersionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -44,30 +44,30 @@ __all__ = [ "Operations", - "MonitorsOperations", - "ElasticVersionsOperations", "MonitoredSubscriptionsOperations", + "TagRulesOperations", + "MonitorsOperations", "MonitoredResourcesOperations", "DeploymentInfoOperations", "ExternalUserOperations", "BillingInfoOperations", "ConnectedPartnerResourcesOperations", - "OpenAIOperations", - "TagRulesOperations", "VMHostOperations", "VMIngestionOperations", "VMCollectionOperations", "UpgradableVersionsOperations", "MonitorOperations", "AllTrafficFiltersOperations", - "ListAssociatedTrafficFiltersOperations", - "CreateAndAssociateIPFilterOperations", - "CreateAndAssociatePLFilterOperations", + "listAssociatedTrafficFiltersOperations", + "createAndAssociateIPFilterOperations", + "createAndAssociatePLFilterOperations", "AssociateTrafficFilterOperations", "DetachAndDeleteTrafficFilterOperations", "DetachTrafficFilterOperations", "TrafficFiltersOperations", "OrganizationsOperations", + "OpenAIOperations", + "ElasticVersionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py deleted file mode 100644 index 876352eaaaac..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py +++ /dev/null @@ -1,149 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAllTrafficFilters", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AllTrafficFiltersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`all_traffic_filters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.ElasticTrafficFilterResponse: - """List all traffic filters associated with your Elastic monitor resource, helping you manage - network traffic control. - - List all traffic filters associated with your Elastic monitor resource, helping you manage - network traffic control. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: ElasticTrafficFilterResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ElasticTrafficFilterResponse - :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 = 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.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ElasticTrafficFilterResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py deleted file mode 100644 index 4de83b4f5301..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py +++ /dev/null @@ -1,218 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Iterator, Optional, TypeVar, Union, cast - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_associate_request( - resource_group_name: str, - monitor_name: str, - subscription_id: str, - *, - ruleset_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if ruleset_id is not None: - _params["rulesetId"] = _SERIALIZER.query("ruleset_id", ruleset_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AssociateTrafficFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`associate_traffic_filter` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _associate_initial( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_associate_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ruleset_id=ruleset_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_associate( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Associate a traffic filter with your Elastic monitor resource to control and manage network - traffic. - - Associate a traffic filter with your Elastic monitor resource to control and manage network - traffic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ruleset_id: Ruleset Id of the filter. Default value is None. - :type ruleset_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._associate_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - ruleset_id=ruleset_id, - api_version=api_version, - 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 - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_billing_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_billing_info_operations.py deleted file mode 100644 index e875b2f520b5..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_billing_info_operations.py +++ /dev/null @@ -1,149 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/getBillingInfo", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BillingInfoOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`billing_info` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, monitor_name: str, **kwargs: Any) -> _models.BillingInfoResponse: - """Retrieve marketplace and organization billing information mapped to the given Elastic monitor - resource. - - Retrieve marketplace and organization billing information mapped to the given Elastic monitor - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: BillingInfoResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.BillingInfoResponse - :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 = 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.BillingInfoResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BillingInfoResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_connected_partner_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_connected_partner_resources_operations.py deleted file mode 100644 index f4855c19dd96..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_connected_partner_resources_operations.py +++ /dev/null @@ -1,181 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -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.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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listConnectedPartnerResources", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConnectedPartnerResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`connected_partner_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> ItemPaged["_models.ConnectedPartnerResourcesListFormat"]: - """List all active deployments associated with the marketplace subscription linked to the given - Elastic monitor resource. - - List all active deployments associated with the marketplace subscription linked to the given - Elastic monitor resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either ConnectedPartnerResourcesListFormat or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] - :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.ConnectedPartnerResourcesListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ConnectedPartnerResourcesListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py deleted file mode 100644 index eed57dac8100..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py +++ /dev/null @@ -1,235 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Iterator, Optional, TypeVar, Union, cast - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, - monitor_name: str, - subscription_id: str, - *, - ips: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if ips is not None: - _params["ips"] = _SERIALIZER.query("ips", ips, "str") - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CreateAndAssociateIPFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`create_and_associate_ip_filter` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_initial( - self, - resource_group_name: str, - monitor_name: str, - ips: Optional[str] = None, - name: Optional[str] = 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ips=ips, - name=name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - monitor_name: str, - ips: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Create and associate an IP filter with your Elastic monitor resource to control and manage - network traffic. - - Create and associate an IP filter with your Elastic monitor resource to control and manage - network traffic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ips: List of ips. Default value is None. - :type ips: str - :param name: Name of the traffic filter. Default value is None. - :type name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - ips=ips, - name=name, - api_version=api_version, - 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 - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py deleted file mode 100644 index 52e89028777c..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py +++ /dev/null @@ -1,244 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Iterator, Optional, TypeVar, Union, cast - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, - monitor_name: str, - subscription_id: str, - *, - name: Optional[str] = None, - private_endpoint_guid: Optional[str] = None, - private_endpoint_name: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") - if private_endpoint_guid is not None: - _params["privateEndpointGuid"] = _SERIALIZER.query("private_endpoint_guid", private_endpoint_guid, "str") - if private_endpoint_name is not None: - _params["privateEndpointName"] = _SERIALIZER.query("private_endpoint_name", private_endpoint_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CreateAndAssociatePLFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`create_and_associate_pl_filter` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_initial( - self, - resource_group_name: str, - monitor_name: str, - name: Optional[str] = None, - private_endpoint_guid: Optional[str] = None, - private_endpoint_name: Optional[str] = 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - name=name, - private_endpoint_guid=private_endpoint_guid, - private_endpoint_name=private_endpoint_name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - monitor_name: str, - name: Optional[str] = None, - private_endpoint_guid: Optional[str] = None, - private_endpoint_name: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Create and associate a PL filter with your Elastic monitor resource to control and manage - network traffic. - - Create and associate a PL filter with your Elastic monitor resource to control and manage - network traffic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param name: Name of the traffic filter. Default value is None. - :type name: str - :param private_endpoint_guid: Guid of the private endpoint. Default value is None. - :type private_endpoint_guid: str - :param private_endpoint_name: Name of the private endpoint. Default value is None. - :type private_endpoint_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - name=name, - private_endpoint_guid=private_endpoint_guid, - private_endpoint_name=private_endpoint_name, - api_version=api_version, - 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 - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py deleted file mode 100644 index ef501221e471..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py +++ /dev/null @@ -1,149 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentInfoOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`deployment_info` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.DeploymentInfoResponse: - """Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor - resource. - - Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: DeploymentInfoResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.DeploymentInfoResponse - :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 = 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.DeploymentInfoResponse] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeploymentInfoResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py deleted file mode 100644 index f511a78cec26..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py +++ /dev/null @@ -1,159 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, - monitor_name: str, - subscription_id: str, - *, - ruleset_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachAndDeleteTrafficFilter", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if ruleset_id is not None: - _params["rulesetId"] = _SERIALIZER.query("ruleset_id", ruleset_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DetachAndDeleteTrafficFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`detach_and_delete_traffic_filter` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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 delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = None, **kwargs: Any - ) -> None: - """Detach and delete an existing traffic filter from your Elastic monitor resource, removing its - network traffic control capabilities. - - Detach and delete an existing traffic filter from your Elastic monitor resource, removing its - network traffic control capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ruleset_id: Ruleset Id of the filter. Default value is None. - :type ruleset_id: str - :return: None or the result of cls(response) - :rtype: None - :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 = 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, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ruleset_id=ruleset_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py deleted file mode 100644 index b9f3088c2258..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py +++ /dev/null @@ -1,218 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Iterator, Optional, TypeVar, Union, cast - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_update_request( - resource_group_name: str, - monitor_name: str, - subscription_id: str, - *, - ruleset_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if ruleset_id is not None: - _params["rulesetId"] = _SERIALIZER.query("ruleset_id", ruleset_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DetachTrafficFilterOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`detach_traffic_filter` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _update_initial( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ruleset_id=ruleset_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_update( - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Detach an existing traffic filter from your Elastic monitor resource, removing its network - traffic control capabilities. - - Detach an existing traffic filter from your Elastic monitor resource, removing its network - traffic control capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ruleset_id: Ruleset Id of the filter. Default value is None. - :type ruleset_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - ruleset_id=ruleset_id, - api_version=api_version, - 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 - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_elastic_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_elastic_versions_operations.py deleted file mode 100644 index 64a4ce144833..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_elastic_versions_operations.py +++ /dev/null @@ -1,167 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -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.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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, *, region: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/elasticVersions") - 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") - _params["region"] = _SERIALIZER.query("region", region, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ElasticVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`elastic_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, region: str, **kwargs: Any) -> ItemPaged["_models.ElasticVersionListFormat"]: - """Retrieve a list of all available Elastic versions for a specified region, helping you choose - the best version for your deployment. - - Retrieve a list of all available Elastic versions for a specified region, helping you choose - the best version for your deployment. - - :param region: Region where elastic deployment will take place. Required. - :type region: str - :return: An iterator like instance of either ElasticVersionListFormat or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticVersionListFormat] - :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.ElasticVersionsListResponse] = 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_list_request( - subscription_id=self._config.subscription_id, - region=region, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ElasticVersionsListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py deleted file mode 100644 index 758607f0b628..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py +++ /dev/null @@ -1,242 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - 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.Elastic/monitors/{monitorName}/createOrUpdateExternalUser", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _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 ExternalUserOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`external_user` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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 create_or_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.ExternalUserInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ExternalUserCreationResponse: - """Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic External User Creation Parameters. Default value is None. - :type body: ~azure.mgmt.elastic.models.ExternalUserInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ExternalUserCreationResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ExternalUserCreationResponse: - """Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic External User Creation Parameters. 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: ExternalUserCreationResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ExternalUserInfo, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.ExternalUserCreationResponse: - """Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - Create or update external user configurations for your Elastic monitor resource, enabling - access and management by external users. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic External User Creation Parameters. Is either a ExternalUserInfo type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ExternalUserInfo or IO[bytes] - :return: ExternalUserCreationResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[_models.ExternalUserCreationResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ExternalUserInfo") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ExternalUserCreationResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py deleted file mode 100644 index edbc5d6a4edf..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py +++ /dev/null @@ -1,149 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAssociatedTrafficFilters", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ListAssociatedTrafficFiltersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`list_associated_traffic_filters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.ElasticTrafficFilterResponse: - """List all traffic filters associated with your Elastic monitor resource, helping you manage - network traffic control. - - List all traffic filters associated with your Elastic monitor resource, helping you manage - network traffic control. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: ElasticTrafficFilterResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ElasticTrafficFilterResponse - :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 = 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.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ElasticTrafficFilterResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py deleted file mode 100644 index fddd8ab66ee9..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py +++ /dev/null @@ -1,302 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_upgrade_request( - resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - 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.Elastic/monitors/{monitorName}/upgrade", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _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 MonitorOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`monitor` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _upgrade_initial( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorUpgrade, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ElasticMonitorUpgrade") - else: - _json = None - - _request = build_upgrade_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_upgrade( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.ElasticMonitorUpgrade] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic Monitor Upgrade Parameters. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_upgrade( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic Monitor Upgrade Parameters. 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: 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: - """ - - @distributed_trace - def begin_upgrade( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorUpgrade, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and - performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic Monitor Upgrade Parameters. Is either a ElasticMonitorUpgrade type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade or IO[bytes] - :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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._upgrade_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py deleted file mode 100644 index 8c3754e3d52c..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py +++ /dev/null @@ -1,179 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -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.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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listMonitoredResources", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoredResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`monitored_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> ItemPaged["_models.MonitoredResource"]: - """List all resources currently being monitored by the Elastic monitor resource, helping you - manage observability. - - List all resources currently being monitored by the Elastic monitor resource, helping you - manage observability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either MonitoredResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.MonitoredResource] - :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.MonitoredResourceListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MonitoredResourceListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_subscriptions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_subscriptions_operations.py deleted file mode 100644 index 29096656beda..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_subscriptions_operations.py +++ /dev/null @@ -1,963 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, monitor_name: str, 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", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str", pattern=r"^.*$"), - } - - _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_createor_update_request( - resource_group_name: str, monitor_name: str, 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", "2025-06-01")) - 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.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str", pattern=r"^.*$"), - } - - _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, monitor_name: str, 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", "2025-06-01")) - 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.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str", pattern=r"^.*$"), - } - - _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, monitor_name: str, 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", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoredSubscriptionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`monitored_subscriptions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> ItemPaged["_models.MonitoredSubscriptionProperties"]: - """List all subscriptions currently being monitored by the Elastic monitor resource, helping you - manage observability. - - List all subscriptions currently being monitored by the Elastic monitor resource, helping you - manage observability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either MonitoredSubscriptionProperties or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :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.MonitoredSubscriptionPropertiesList] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MonitoredSubscriptionPropertiesList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, monitor_name: str, configuration_name: str, **kwargs: Any - ) -> _models.MonitoredSubscriptionProperties: - """Get detailed information about all subscriptions currently being monitored by the Elastic - monitor resource. - - Get detailed information about all subscriptions currently being monitored by the Elastic - monitor resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :return: MonitoredSubscriptionProperties or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties - :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 = 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.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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("MonitoredSubscriptionProperties", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _createor_update_initial( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[Union[_models.MonitoredSubscriptionProperties, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "MonitoredSubscriptionProperties") - else: - _json = None - - _request = build_createor_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_createor_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[_models.MonitoredSubscriptionProperties] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MonitoredSubscriptionProperties]: - """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: Default value is None. - :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_createor_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MonitoredSubscriptionProperties]: - """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: 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: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_createor_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[Union[_models.MonitoredSubscriptionProperties, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.MonitoredSubscriptionProperties]: - """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and - monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: Is either a MonitoredSubscriptionProperties type or a IO[bytes] type. Default - value is None. - :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties or IO[bytes] - :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.MonitoredSubscriptionProperties] = 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._createor_update_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoredSubscriptionProperties].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoredSubscriptionProperties]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[Union[_models.MonitoredSubscriptionProperties, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "MonitoredSubscriptionProperties") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = 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["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[_models.MonitoredSubscriptionProperties] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MonitoredSubscriptionProperties]: - """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: Default value is None. - :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MonitoredSubscriptionProperties]: - """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: 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: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - monitor_name: str, - configuration_name: str, - body: Optional[Union[_models.MonitoredSubscriptionProperties, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.MonitoredSubscriptionProperties]: - """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :param body: Is either a MonitoredSubscriptionProperties type or a IO[bytes] type. Default - value is None. - :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties or IO[bytes] - :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.MonitoredSubscriptionProperties] = 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, - monitor_name=monitor_name, - configuration_name=configuration_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoredSubscriptionProperties].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoredSubscriptionProperties]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, monitor_name: str, configuration_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = 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["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - 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, monitor_name: str, configuration_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete subscriptions being monitored by the Elastic monitor resource, removing their - observability and monitoring capabilities. - - Delete subscriptions being monitored by the Elastic monitor resource, removing their - observability and monitoring capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param configuration_name: The configuration name. Only 'default' value is supported. Required. - :type configuration_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - configuration_name=configuration_name, - api_version=api_version, - 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 - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py deleted file mode 100644 index c3c67762ef18..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py +++ /dev/null @@ -1,1023 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _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, monitor_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - 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.Elastic/monitors/{monitorName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _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, monitor_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - 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.Elastic/monitors/{monitorName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _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, monitor_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`monitors` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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) -> ItemPaged["_models.ElasticMonitorResource"]: - """List all Elastic monitor resources within a specified subscription, helping you audit and - manage your monitoring setup. - - List all Elastic monitor resources within a specified subscription, helping you audit and - manage your monitoring setup. - - :return: An iterator like instance of either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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.ElasticMonitorResourceListResponse] = 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_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ElasticMonitorResourceListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.ElasticMonitorResource"]: - """List all Elastic monitor resources within a specified resource group of the subscription, - helping you audit and manage your monitoring setup. - - List all Elastic monitor resources within a specified resource group of the subscription, - helping you audit and manage your monitoring setup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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.ElasticMonitorResourceListResponse] = 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_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ElasticMonitorResourceListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.ElasticMonitorResource: - """Get detailed properties of a specific Elastic monitor resource, helping you manage - observability and performance. - - Get detailed properties of a specific Elastic monitor resource, helping you manage - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: ElasticMonitorResource or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ElasticMonitorResource - :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 = 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.ElasticMonitorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ElasticMonitorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorResource, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ElasticMonitorResource") - else: - _json = None - - _request = build_create_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.ElasticMonitorResource] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ElasticMonitorResource]: - """Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic monitor resource model. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ElasticMonitorResource]: - """Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic monitor resource 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: An instance of LROPoller that returns either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorResource, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.ElasticMonitorResource]: - """Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - Create a new Elastic monitor resource in your Azure subscription, enabling observability and - monitoring of your Azure resources through Elastic. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic monitor resource model. Is either a ElasticMonitorResource type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource or IO[bytes] - :return: An instance of LROPoller that returns either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.ElasticMonitorResource] = 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, - monitor_name=monitor_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("ElasticMonitorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ElasticMonitorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ElasticMonitorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorResourceUpdateParameters, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ElasticMonitorResourceUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = 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["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.ElasticMonitorResourceUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ElasticMonitorResource]: - """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic resource model update parameters. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ElasticMonitorResource]: - """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic resource model update parameters. 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: An instance of LROPoller that returns either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ElasticMonitorResourceUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.ElasticMonitorResource]: - """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Elastic resource model update parameters. Is either a - ElasticMonitorResourceUpdateParameters type or a IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.ElasticMonitorResource] = 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, - monitor_name=monitor_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("ElasticMonitorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ElasticMonitorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ElasticMonitorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, monitor_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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, 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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete an existing Elastic monitor resource from your Azure subscription, removing its - observability and monitoring capabilities. - - Delete an existing Elastic monitor resource from your Azure subscription, removing its - observability and monitoring capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - api_version=api_version, - 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 - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_open_ai_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_open_ai_operations.py deleted file mode 100644 index 83611bb65502..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_open_ai_operations.py +++ /dev/null @@ -1,674 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -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.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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, monitor_name: str, integration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "integrationName": _SERIALIZER.url("integration_name", integration_name, "str", pattern=r"^[a-z][a-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_or_update_request( - resource_group_name: str, monitor_name: str, integration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - 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.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "integrationName": _SERIALIZER.url("integration_name", integration_name, "str", pattern=r"^[a-z][a-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, monitor_name: str, integration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "integrationName": _SERIALIZER.url("integration_name", integration_name, "str", pattern=r"^[a-z][a-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_get_status_request( - resource_group_name: str, monitor_name: str, integration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}/getStatus", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "integrationName": _SERIALIZER.url("integration_name", integration_name, "str", pattern=r"^[a-z][a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class OpenAIOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`open_ai` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> ItemPaged["_models.OpenAIIntegrationRPModel"]: - """List all OpenAI integration rules for a given Elastic monitor resource, helping you manage - AI-driven observability and monitoring. - - List all OpenAI integration rules for a given Elastic monitor resource, helping you manage - AI-driven observability and monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either OpenAIIntegrationRPModel or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] - :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.OpenAIIntegrationRPModelListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OpenAIIntegrationRPModelListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any - ) -> _models.OpenAIIntegrationRPModel: - """Get detailed information about OpenAI integration rules for a given Elastic monitor resource. - - Get detailed information about OpenAI integration rules for a given Elastic monitor resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :return: OpenAIIntegrationRPModel or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :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 = 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.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - integration_name=integration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - integration_name: str, - body: Optional[_models.OpenAIIntegrationRPModel] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.OpenAIIntegrationRPModel: - """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :param body: Default value is None. - :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: OpenAIIntegrationRPModel or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - integration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.OpenAIIntegrationRPModel: - """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :param body: 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: OpenAIIntegrationRPModel or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - integration_name: str, - body: Optional[Union[_models.OpenAIIntegrationRPModel, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.OpenAIIntegrationRPModel: - """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling - advanced AI-driven observability and monitoring. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :param body: Is either a OpenAIIntegrationRPModel type or a IO[bytes] type. Default value is - None. - :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel or IO[bytes] - :return: OpenAIIntegrationRPModel or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[_models.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "OpenAIIntegrationRPModel") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - integration_name=integration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any - ) -> None: - """Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven - observability and monitoring capabilities. - - Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven - observability and monitoring capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :return: None or the result of cls(response) - :rtype: None - :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 = 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, - monitor_name=monitor_name, - integration_name=integration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_status( - self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any - ) -> _models.OpenAIIntegrationStatusResponse: - """Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal - observability and performance. - - Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param integration_name: OpenAI Integration name. Required. - :type integration_name: str - :return: OpenAIIntegrationStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponse - :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 = 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.OpenAIIntegrationStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_status_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - integration_name=integration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenAIIntegrationStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py index 82363e557506..e45d9c545f03 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py @@ -1,12 +1,15 @@ +# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -16,17 +19,22 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration +from .. import models as _models, types as _types +from .._configuration import ElasticMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") @@ -37,7 +45,7 @@ _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 {}) @@ -45,7 +53,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Elastic/operations") + _url = "/providers/Microsoft.Elastic/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -56,40 +64,6930 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_monitored_subscriptions_get_request( # pylint: disable=name-too-long + resource_group_name: str, monitor_name: str, 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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", 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_monitored_subscriptions_createor_update_request( # pylint: disable=name-too-long + resource_group_name: str, monitor_name: str, 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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", 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_monitored_subscriptions_update_request( # pylint: disable=name-too-long + resource_group_name: str, monitor_name: str, 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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", 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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_monitored_subscriptions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, monitor_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_monitored_subscriptions_list_request( # pylint: disable=name-too-long + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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_tag_rules_get_request( + resource_group_name: str, monitor_name: str, rule_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_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_tag_rules_create_or_update_request( + resource_group_name: str, monitor_name: str, rule_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_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_tag_rules_delete_request( + resource_group_name: str, monitor_name: str, rule_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_tag_rules_list_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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_monitors_get_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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_monitors_create_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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_monitors_update_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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_monitors_delete_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_monitors_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_monitors_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors" + 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_monitored_resources_list_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listMonitoredResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_info_list_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_external_user_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createOrUpdateExternalUser" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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_billing_info_get_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/getBillingInfo" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connected_partner_resources_list_request( # pylint: disable=name-too-long + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listConnectedPartnerResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vm_host_list_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listVMHost" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vm_ingestion_details_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vm_collection_update_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmCollectionUpdate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgradable_versions_details_request( # pylint: disable=name-too-long + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listUpgradableVersions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_monitor_upgrade_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_all_traffic_filters_list_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAllTrafficFilters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_associated_traffic_filters_list_request( # pylint: disable=name-too-long + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAssociatedTrafficFilters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_and_associate_ip_filter_create_request( # pylint: disable=name-too-long + resource_group_name: str, + monitor_name: str, + subscription_id: str, + *, + ips: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ips is not None: + _params["ips"] = _SERIALIZER.query("ips", ips, "str") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_create_and_associate_pl_filter_create_request( # pylint: disable=name-too-long + resource_group_name: str, + monitor_name: str, + subscription_id: str, + *, + name: Optional[str] = None, + private_endpoint_guid: Optional[str] = None, + private_endpoint_name: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if private_endpoint_guid is not None: + _params["privateEndpointGuid"] = _SERIALIZER.query("private_endpoint_guid", private_endpoint_guid, "str") + if private_endpoint_name is not None: + _params["privateEndpointName"] = _SERIALIZER.query("private_endpoint_name", private_endpoint_name, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_associate_traffic_filter_associate_request( # pylint: disable=name-too-long + resource_group_name: str, + monitor_name: str, + subscription_id: str, + *, + ruleset_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ruleset_id is not None: + _params["rulesetId"] = _SERIALIZER.query("ruleset_id", ruleset_id, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_detach_and_delete_traffic_filter_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + monitor_name: str, + subscription_id: str, + *, + ruleset_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachAndDeleteTrafficFilter" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ruleset_id is not None: + _params["rulesetId"] = _SERIALIZER.query("ruleset_id", ruleset_id, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_detach_traffic_filter_update_request( # pylint: disable=name-too-long + resource_group_name: str, + monitor_name: str, + subscription_id: str, + *, + ruleset_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ruleset_id is not None: + _params["rulesetId"] = _SERIALIZER.query("ruleset_id", ruleset_id, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_traffic_filters_delete_request( + resource_group_name: str, + monitor_name: str, + subscription_id: str, + *, + ruleset_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/deleteTrafficFilter" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ruleset_id is not None: + _params["rulesetId"] = _SERIALIZER.query("ruleset_id", ruleset_id, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_organizations_resubscribe_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/resubscribe" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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_organizations_get_api_key_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getOrganizationApiKey" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_organizations_get_elastic_to_azure_subscription_mapping_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getElasticOrganizationToAzureSubscriptionMapping" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_open_ai_get_request( + resource_group_name: str, monitor_name: str, integration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "integrationName": _SERIALIZER.url("integration_name", integration_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_open_ai_create_or_update_request( + resource_group_name: str, monitor_name: str, integration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "integrationName": _SERIALIZER.url("integration_name", integration_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_open_ai_delete_request( + resource_group_name: str, monitor_name: str, integration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "integrationName": _SERIALIZER.url("integration_name", integration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_open_ai_list_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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_open_ai_get_status_request( + resource_group_name: str, monitor_name: str, integration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}/getStatus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "integrationName": _SERIALIZER.url("integration_name", integration_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_elastic_versions_list_request(subscription_id: str, *, region: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/elasticVersions" + 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") + _params["region"] = _SERIALIZER.query("region", region, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + class Operations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`operations` attribute. + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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) -> ItemPaged["_models.OperationResult"]: + """List the operations for the provider. + + :return: An iterator like instance of OperationResult + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.OperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationResult]] = 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), + headers=_headers, + 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.OperationResult], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class MonitoredSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`monitored_subscriptions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> _models.MonitoredSubscriptionProperties: + """Get detailed information about all subscriptions currently being monitored by the Elastic + monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :return: MonitoredSubscriptionProperties. The MonitoredSubscriptionProperties is compatible + with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties + :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.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) + + _request = build_monitored_subscriptions_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MonitoredSubscriptionProperties, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _createor_update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[ + Union[_models.MonitoredSubscriptionProperties, _types.MonitoredSubscriptionProperties, IO[bytes]] + ] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitored_subscriptions_createor_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_models.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and + monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties + :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 MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_types.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and + monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.types.MonitoredSubscriptionProperties + :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 MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and + monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: 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: An instance of LROPoller that returns MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[ + Union[_models.MonitoredSubscriptionProperties, _types.MonitoredSubscriptionProperties, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and + monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Is either a MonitoredSubscriptionProperties type or a IO[bytes] type. Default + value is None. + :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties or + ~azure.mgmt.elastic.types.MonitoredSubscriptionProperties or IO[bytes] + :return: An instance of LROPoller that returns MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.MonitoredSubscriptionProperties] = 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._createor_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_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 = pipeline_response.http_response + deserialized = _deserialize(_models.MonitoredSubscriptionProperties, 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.MonitoredSubscriptionProperties].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MonitoredSubscriptionProperties]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[ + Union[_models.MonitoredSubscriptionProperties, _types.MonitoredSubscriptionProperties, IO[bytes]] + ] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitored_subscriptions_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_models.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties + :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 MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_types.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.types.MonitoredSubscriptionProperties + :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 MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: 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: An instance of LROPoller that returns MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[ + Union[_models.MonitoredSubscriptionProperties, _types.MonitoredSubscriptionProperties, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param configuration_name: Required. + :type configuration_name: str + :param body: Is either a MonitoredSubscriptionProperties type or a IO[bytes] type. Default + value is None. + :type body: ~azure.mgmt.elastic.models.MonitoredSubscriptionProperties or + ~azure.mgmt.elastic.types.MonitoredSubscriptionProperties or IO[bytes] + :return: An instance of LROPoller that returns MonitoredSubscriptionProperties. The + MonitoredSubscriptionProperties is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.MonitoredSubscriptionProperties] = 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, + monitor_name=monitor_name, + configuration_name=configuration_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 = pipeline_response.http_response + deserialized = _deserialize(_models.MonitoredSubscriptionProperties, 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.MonitoredSubscriptionProperties].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MonitoredSubscriptionProperties]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, monitor_name: str, configuration_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_monitored_subscriptions_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + 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 _decompress else response.iter_raw() + + 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, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete subscriptions being monitored by the Elastic monitor resource, removing their + observability and monitoring capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_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, + monitor_name=monitor_name, + configuration_name=configuration_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, monitor_name: str, **kwargs: Any + ) -> ItemPaged["_models.MonitoredSubscriptionProperties"]: + """List all subscriptions currently being monitored by the Elastic monitor resource, helping you + manage observability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of MonitoredSubscriptionProperties + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MonitoredSubscriptionProperties]] = 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_monitored_subscriptions_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.MonitoredSubscriptionProperties], + 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class TagRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`tag_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, monitor_name: str, rule_set_name: str, **kwargs: Any + ) -> _models.MonitoringTagRules: + """Get detailed information about a tag rule set for a given Elastic monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param rule_set_name: Tag Rule Set resource name. Required. + :type rule_set_name: str + :return: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :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.MonitoringTagRules] = kwargs.pop("cls", None) + + _request = build_tag_rules_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MonitoringTagRules, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[_models.MonitoringTagRules] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MonitoringTagRules: + """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param rule_set_name: Required. + :type rule_set_name: str + :param body: request body of MonitoringTagRules. Default value is None. + :type body: ~azure.mgmt.elastic.models.MonitoringTagRules + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[_types.MonitoringTagRules] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MonitoringTagRules: + """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param rule_set_name: Required. + :type rule_set_name: str + :param body: request body of MonitoringTagRules. Default value is None. + :type body: ~azure.mgmt.elastic.types.MonitoringTagRules + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MonitoringTagRules: + """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param rule_set_name: Required. + :type rule_set_name: str + :param body: request body of MonitoringTagRules. 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: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional[Union[_models.MonitoringTagRules, _types.MonitoringTagRules, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.MonitoringTagRules: + """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param rule_set_name: Required. + :type rule_set_name: str + :param body: request body of MonitoringTagRules. Is either a MonitoringTagRules type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.MonitoringTagRules or + ~azure.mgmt.elastic.types.MonitoringTagRules or IO[bytes] + :return: MonitoringTagRules. The MonitoringTagRules is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules + :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)) + content_type = content_type if body else None + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_tag_rules_create_or_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MonitoringTagRules, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, monitor_name: str, rule_set_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_tag_rules_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_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) + + _decompress = kwargs.pop("decompress", True) + _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, 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.ResourceProviderDefaultErrorResponse, + response, + ) + 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 _decompress else response.iter_raw() + + 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, monitor_name: str, rule_set_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over + observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param rule_set_name: Tag Rule Set resource name. Required. + :type rule_set_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, + monitor_name=monitor_name, + rule_set_name=rule_set_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, monitor_name: str, **kwargs: Any + ) -> ItemPaged["_models.MonitoringTagRules"]: + """List all tag rules for a given Elastic monitor resource, helping you manage fine-grained + control over observability based on resource tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of MonitoringTagRules + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.MonitoringTagRules] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MonitoringTagRules]] = 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_tag_rules_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.MonitoringTagRules], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class MonitorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`monitors` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, monitor_name: str, **kwargs: Any) -> _models.ElasticMonitorResource: + """Get detailed properties of a specific Elastic monitor resource, helping you manage + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: ElasticMonitorResource. The ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.ElasticMonitorResource + :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.ElasticMonitorResource] = kwargs.pop("cls", None) + + _request = build_monitors_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ElasticMonitorResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ElasticMonitorResource, _types.ElasticMonitorResource, IO[bytes]]] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitors_create_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.ElasticMonitorResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Create a new Elastic monitor resource in your Azure subscription, enabling observability and + monitoring of your Azure resources through Elastic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic monitor resource model. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ElasticMonitorResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Create a new Elastic monitor resource in your Azure subscription, enabling observability and + monitoring of your Azure resources through Elastic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic monitor resource model. Default value is None. + :type body: ~azure.mgmt.elastic.types.ElasticMonitorResource + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Create a new Elastic monitor resource in your Azure subscription, enabling observability and + monitoring of your Azure resources through Elastic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic monitor resource 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: An instance of LROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ElasticMonitorResource, _types.ElasticMonitorResource, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Create a new Elastic monitor resource in your Azure subscription, enabling observability and + monitoring of your Azure resources through Elastic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic monitor resource model. Is either a ElasticMonitorResource type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource or + ~azure.mgmt.elastic.types.ElasticMonitorResource or IO[bytes] + :return: An instance of LROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.ElasticMonitorResource] = 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, + monitor_name=monitor_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 = pipeline_response.http_response + deserialized = _deserialize(_models.ElasticMonitorResource, 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.ElasticMonitorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ElasticMonitorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ + Union[ + _models.ElasticMonitorResourceUpdateParameters, _types.ElasticMonitorResourceUpdateParameters, IO[bytes] + ] + ] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitors_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + 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")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.ElasticMonitorResourceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic resource model update parameters. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ElasticMonitorResourceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic resource model update parameters. Default value is None. + :type body: ~azure.mgmt.elastic.types.ElasticMonitorResourceUpdateParameters + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic resource model update parameters. 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: An instance of LROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[ + Union[ + _models.ElasticMonitorResourceUpdateParameters, _types.ElasticMonitorResourceUpdateParameters, IO[bytes] + ] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param body: Elastic resource model update parameters. Is either a + ElasticMonitorResourceUpdateParameters type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters or + ~azure.mgmt.elastic.types.ElasticMonitorResourceUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.ElasticMonitorResource] = 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, + monitor_name=monitor_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 = pipeline_response.http_response + deserialized = _deserialize(_models.ElasticMonitorResource, 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.ElasticMonitorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ElasticMonitorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, monitor_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_monitors_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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, 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.ResourceProviderDefaultErrorResponse, + response, + ) + 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 _decompress else response.iter_raw() + + 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, monitor_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete an existing Elastic monitor resource from your Azure subscription, removing its + observability and monitoring capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_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, + monitor_name=monitor_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_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ElasticMonitorResource"]: + """List all Elastic monitor resources within a specified resource group of the subscription, + helping you audit and manage your monitoring setup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of ElasticMonitorResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ElasticMonitorResource]] = 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_monitors_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + 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.ElasticMonitorResource], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.ElasticMonitorResource"]: + """List all Elastic monitor resources within a specified subscription, helping you audit and + manage your monitoring setup. + + :return: An iterator like instance of ElasticMonitorResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ElasticMonitorResource]] = 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_monitors_list_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), + headers=_headers, + 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.ElasticMonitorResource], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class MonitoredResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`monitored_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> ItemPaged["_models.MonitoredResource"]: + """List all resources currently being monitored by the Elastic monitor resource, helping you + manage observability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of MonitoredResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.MonitoredResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MonitoredResource]] = 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_monitored_resources_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.MonitoredResource], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DeploymentInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`deployment_info` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.DeploymentInfoResponse: + """Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: DeploymentInfoResponse. The DeploymentInfoResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.DeploymentInfoResponse + :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.DeploymentInfoResponse] = kwargs.pop("cls", None) + + _request = build_deployment_info_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DeploymentInfoResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExternalUserOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`external_user` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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 create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.ExternalUserInfo] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExternalUserCreationResponse: + """Create or update external user configurations for your Elastic monitor resource, enabling + access and management by external users. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic External User Creation Parameters. Default value is None. + :type body: ~azure.mgmt.elastic.models.ExternalUserInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ExternalUserCreationResponse. The ExternalUserCreationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ExternalUserInfo] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExternalUserCreationResponse: + """Create or update external user configurations for your Elastic monitor resource, enabling + access and management by external users. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic External User Creation Parameters. Default value is None. + :type body: ~azure.mgmt.elastic.types.ExternalUserInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ExternalUserCreationResponse. The ExternalUserCreationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExternalUserCreationResponse: + """Create or update external user configurations for your Elastic monitor resource, enabling + access and management by external users. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic External User Creation Parameters. 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: ExternalUserCreationResponse. The ExternalUserCreationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ExternalUserInfo, _types.ExternalUserInfo, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ExternalUserCreationResponse: + """Create or update external user configurations for your Elastic monitor resource, enabling + access and management by external users. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic External User Creation Parameters. Is either a ExternalUserInfo type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ExternalUserInfo or + ~azure.mgmt.elastic.types.ExternalUserInfo or IO[bytes] + :return: ExternalUserCreationResponse. The ExternalUserCreationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ExternalUserCreationResponse + :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)) + content_type = content_type if body else None + cls: ClsType[_models.ExternalUserCreationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_external_user_create_or_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ExternalUserCreationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BillingInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`billing_info` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, monitor_name: str, **kwargs: Any) -> _models.BillingInfoResponse: + """Retrieve marketplace and organization billing information mapped to the given Elastic monitor + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: BillingInfoResponse. The BillingInfoResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.BillingInfoResponse + :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.BillingInfoResponse] = kwargs.pop("cls", None) + + _request = build_billing_info_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.BillingInfoResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ConnectedPartnerResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`connected_partner_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> ItemPaged["_models.ConnectedPartnerResourcesListFormat"]: + """List all active deployments associated with the marketplace subscription linked to the given + Elastic monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of ConnectedPartnerResourcesListFormat + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConnectedPartnerResourcesListFormat]] = 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_connected_partner_resources_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.ConnectedPartnerResourcesListFormat], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VMHostOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`vm_host` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> ItemPaged["_models.VMResources"]: + """List all VM resources currently being monitored by the Elastic monitor resource, helping you + manage observability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of VMResources + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.VMResources] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VMResources]] = 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_vm_host_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.VMResources], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VMIngestionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`vm_ingestion` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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 details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.VMIngestionDetailsResponse: + """List detailed information about VM ingestion that will be monitored by the Elastic monitor + resource, ensuring optimal observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: VMIngestionDetailsResponse. The VMIngestionDetailsResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.VMIngestionDetailsResponse + :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.VMIngestionDetailsResponse] = kwargs.pop("cls", None) + + _request = build_vm_ingestion_details_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VMIngestionDetailsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VMCollectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`vm_collection` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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 update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.VMCollectionUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: VM resource Id. Default value is None. + :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.VMCollectionUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: VM resource Id. Default value is None. + :type body: ~azure.mgmt.elastic.types.VMCollectionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: VM resource Id. 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: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.VMCollectionUpdate, _types.VMCollectionUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: VM resource Id. Is either a VMCollectionUpdate type or a IO[bytes] type. Default + value is None. + :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate or + ~azure.mgmt.elastic.types.VMCollectionUpdate or IO[bytes] + :return: None + :rtype: None + :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)) + content_type = content_type if body else None + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_vm_collection_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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 = 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class UpgradableVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`upgradable_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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 details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.UpgradableVersionsList: + """List all upgradable versions for your Elastic monitor resource, helping you plan and execute + upgrades. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: UpgradableVersionsList. The UpgradableVersionsList is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UpgradableVersionsList + :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.UpgradableVersionsList] = kwargs.pop("cls", None) + + _request = build_upgradable_versions_details_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.UpgradableVersionsList, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class MonitorOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`monitor` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _upgrade_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ElasticMonitorUpgrade, _types.ElasticMonitorUpgrade, IO[bytes]]] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_monitor_upgrade_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.ElasticMonitorUpgrade] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and + performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic Monitor Upgrade Parameters. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ElasticMonitorUpgrade] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and + performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic Monitor Upgrade Parameters. Default value is None. + :type body: ~azure.mgmt.elastic.types.ElasticMonitorUpgrade + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and + performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic Monitor Upgrade Parameters. 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: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_upgrade( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ElasticMonitorUpgrade, _types.ElasticMonitorUpgrade, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and + performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Elastic Monitor Upgrade Parameters. Is either a ElasticMonitorUpgrade type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade or + ~azure.mgmt.elastic.types.ElasticMonitorUpgrade or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._upgrade_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_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): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class AllTrafficFiltersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`all_traffic_filters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.ElasticTrafficFilterResponse: + """List all traffic filters associated with your Elastic monitor resource, helping you manage + network traffic control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: ElasticTrafficFilterResponse. The ElasticTrafficFilterResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ElasticTrafficFilterResponse + :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.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) + + _request = build_all_traffic_filters_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ElasticTrafficFilterResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class listAssociatedTrafficFiltersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`list_associated_traffic_filters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.ElasticTrafficFilterResponse: + """List all traffic filters associated with your Elastic monitor resource, helping you manage + network traffic control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: ElasticTrafficFilterResponse. The ElasticTrafficFilterResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.ElasticTrafficFilterResponse + :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.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) + + _request = build_list_associated_traffic_filters_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ElasticTrafficFilterResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class createAndAssociateIPFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`create_and_associate_ip_filter` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + *, + ips: Optional[str] = None, + name: Optional[str] = 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_create_and_associate_ip_filter_create_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ips=ips, + name=name, + 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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + ips: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Create and associate an IP filter with your Elastic monitor resource to control and manage + network traffic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ips: List of ips. Default value is None. + :paramtype ips: str + :keyword name: Name of the traffic filter. Default value is None. + :paramtype 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._create_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + ips=ips, + name=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 + + +class createAndAssociatePLFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`create_and_associate_pl_filter` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + *, + name: Optional[str] = None, + private_endpoint_guid: Optional[str] = None, + private_endpoint_name: Optional[str] = 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_create_and_associate_pl_filter_create_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + name=name, + private_endpoint_guid=private_endpoint_guid, + private_endpoint_name=private_endpoint_name, + 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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + name: Optional[str] = None, + private_endpoint_guid: Optional[str] = None, + private_endpoint_name: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Create and associate a PL filter with your Elastic monitor resource to control and manage + network traffic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword name: Name of the traffic filter. Default value is None. + :paramtype name: str + :keyword private_endpoint_guid: Guid of the private endpoint. Default value is None. + :paramtype private_endpoint_guid: str + :keyword private_endpoint_name: Name of the private endpoint. Default value is None. + :paramtype private_endpoint_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._create_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + name=name, + private_endpoint_guid=private_endpoint_guid, + private_endpoint_name=private_endpoint_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 + + +class AssociateTrafficFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`associate_traffic_filter` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _associate_initial( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = 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_associate_traffic_filter_associate_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ruleset_id=ruleset_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) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_associate( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = None, **kwargs: Any + ) -> LROPoller[None]: + """Associate a traffic filter with your Elastic monitor resource to control and manage network + traffic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ruleset_id: Ruleset Id of the filter. Default value is None. + :paramtype ruleset_id: 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._associate_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + ruleset_id=ruleset_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class DetachAndDeleteTrafficFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`detach_and_delete_traffic_filter` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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 delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = None, **kwargs: Any + ) -> None: + """Detach and delete an existing traffic filter from your Elastic monitor resource, removing its + network traffic control capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ruleset_id: Ruleset Id of the filter. Default value is None. + :paramtype ruleset_id: str + :return: None + :rtype: None + :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[None] = kwargs.pop("cls", None) + + _request = build_detach_and_delete_traffic_filter_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ruleset_id=ruleset_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 = 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class DetachTrafficFilterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`detach_traffic_filter` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _update_initial( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = 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_detach_traffic_filter_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ruleset_id=ruleset_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) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_update( + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = None, **kwargs: Any + ) -> LROPoller[None]: + """Detach an existing traffic filter from your Elastic monitor resource, removing its network + traffic control capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ruleset_id: Ruleset Id of the filter. Default value is None. + :paramtype ruleset_id: 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._update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + ruleset_id=ruleset_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class TrafficFiltersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`traffic_filters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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 delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, monitor_name: str, *, ruleset_id: Optional[str] = None, **kwargs: Any + ) -> None: + """Delete an existing traffic filter associated with your Elastic monitor resource, removing its + network traffic control capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword ruleset_id: Ruleset Id of the filter. Default value is None. + :paramtype ruleset_id: str + :return: None + :rtype: None + :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[None] = kwargs.pop("cls", None) + + _request = build_traffic_filters_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + ruleset_id=ruleset_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 = 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class OrganizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`organizations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _resubscribe_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ResubscribeProperties, _types.ResubscribeProperties, IO[bytes]]] = 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 = 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)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_organizations_resubscribe_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + _decompress = kwargs.pop("decompress", True) + _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, + ) + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_models.ResubscribeProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Resubscribe the Elasticsearch Organization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Resubscribe Properties. Default value is None. + :type body: ~azure.mgmt.elastic.models.ResubscribeProperties + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[_types.ResubscribeProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Resubscribe the Elasticsearch Organization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Resubscribe Properties. Default value is None. + :type body: ~azure.mgmt.elastic.types.ResubscribeProperties + :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 ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Resubscribe the Elasticsearch Organization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Resubscribe Properties. 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: An instance of LROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resubscribe( + self, + resource_group_name: str, + monitor_name: str, + body: Optional[Union[_models.ResubscribeProperties, _types.ResubscribeProperties, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.ElasticMonitorResource]: + """Resubscribe the Elasticsearch Organization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param body: Resubscribe Properties. Is either a ResubscribeProperties type or a IO[bytes] + type. Default value is None. + :type body: ~azure.mgmt.elastic.models.ResubscribeProperties or + ~azure.mgmt.elastic.types.ResubscribeProperties or IO[bytes] + :return: An instance of LROPoller that returns ElasticMonitorResource. The + ElasticMonitorResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] + :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)) + content_type = content_type if body else None + cls: ClsType[_models.ElasticMonitorResource] = 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._resubscribe_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_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 = pipeline_response.http_response + deserialized = _deserialize(_models.ElasticMonitorResource, 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.ElasticMonitorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ElasticMonitorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def get_api_key( + self, body: Optional[_models.UserEmailId] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + :param body: The request body. Default value is None. + :type body: ~azure.mgmt.elastic.models.UserEmailId + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UserApiKeyResponse. The UserApiKeyResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_api_key( + self, body: Optional[_types.UserEmailId] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + :param body: The request body. Default value is None. + :type body: ~azure.mgmt.elastic.types.UserEmailId + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UserApiKeyResponse. The UserApiKeyResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_api_key( + self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + :param body: The request body. 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: UserApiKeyResponse. The UserApiKeyResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_api_key( + self, body: Optional[Union[_models.UserEmailId, _types.UserEmailId, IO[bytes]]] = None, **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + Fetch the User API Key from the internal database, if it was generated and stored during the + creation of the Elasticsearch Organization. + + :param body: The request body. Is either a UserEmailId type or a IO[bytes] type. Default value + is None. + :type body: ~azure.mgmt.elastic.models.UserEmailId or ~azure.mgmt.elastic.types.UserEmailId or + IO[bytes] + :return: UserApiKeyResponse. The UserApiKeyResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :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)) + content_type = content_type if body else None + cls: ClsType[_models.UserApiKeyResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_organizations_get_api_key_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.UserApiKeyResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_elastic_to_azure_subscription_mapping( # pylint: disable=name-too-long + self, **kwargs: Any + ) -> _models.ElasticOrganizationToAzureSubscriptionMappingResponse: + """Retrieve mapping details between the Elastic Organization and Azure Subscription for the + logged-in user. + + ; + /** + Retrieve mapping details between the Elastic Organization and Azure Subscription for the + logged-in user. + + . + + :return: ElasticOrganizationToAzureSubscriptionMappingResponse. The + ElasticOrganizationToAzureSubscriptionMappingResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse + :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.ElasticOrganizationToAzureSubscriptionMappingResponse] = kwargs.pop("cls", None) + + _request = build_organizations_get_elastic_to_azure_subscription_mapping_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ElasticOrganizationToAzureSubscriptionMappingResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OpenAIOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`open_ai` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ElasticMgmtClientConfiguration = 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, monitor_name: str, integration_name: str, **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Get detailed information about OpenAI integration rules for a given Elastic monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :return: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :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.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) + + _request = build_open_ai_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OpenAIIntegrationRPModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[_models.OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling + advanced AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param integration_name: Required. + :type integration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[_types.OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling + advanced AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param integration_name: Required. + :type integration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.types.OpenAIIntegrationRPModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling + advanced AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param integration_name: Required. + :type integration_name: str + :param body: 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: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[Union[_models.OpenAIIntegrationRPModel, _types.OpenAIIntegrationRPModel, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling + advanced AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Required. + :type monitor_name: str + :param integration_name: Required. + :type integration_name: str + :param body: Is either a OpenAIIntegrationRPModel type or a IO[bytes] type. Default value is + None. + :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel or + ~azure.mgmt.elastic.types.OpenAIIntegrationRPModel or IO[bytes] + :return: OpenAIIntegrationRPModel. The OpenAIIntegrationRPModel is compatible with + MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :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)) + content_type = content_type if body else None + cls: ClsType[_models.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _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_open_ai_create_or_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OpenAIIntegrationRPModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any + ) -> None: + """Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven + observability and monitoring capabilities. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :return: None + :rtype: None + :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[None] = kwargs.pop("cls", None) + + _request = build_open_ai_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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 = 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> ItemPaged["_models.OpenAIIntegrationRPModel"]: + """List all OpenAI integration rules for a given Elastic monitor resource, helping you manage + AI-driven observability and monitoring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :return: An iterator like instance of OpenAIIntegrationRPModel + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OpenAIIntegrationRPModel]] = 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_open_ai_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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), + headers=_headers, + 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.OpenAIIntegrationRPModel], + 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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_status( + self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any + ) -> _models.OpenAIIntegrationStatusResponse: + """Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal + observability and performance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :return: OpenAIIntegrationStatusResponse. The OpenAIIntegrationStatusResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponse + :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.OpenAIIntegrationStatusResponse] = kwargs.pop("cls", None) + + _request = build_open_ai_get_status_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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) + + _decompress = kwargs.pop("decompress", True) + _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.ResourceProviderDefaultErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OpenAIIntegrationStatusResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ElasticVersionsOperations: """ + .. warning:: + **DO NOT** instantiate this class directly. - models = _models + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.ElasticMgmtClient`'s + :attr:`elastic_versions` attribute. + """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ElasticMgmtClientConfiguration = 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) -> ItemPaged["_models.OperationResult"]: - """List all operations provided by Microsoft.Elastic. + def list(self, *, region: str, **kwargs: Any) -> ItemPaged["_models.ElasticVersionListFormat"]: + """Retrieve a list of all available Elastic versions for a specified region, helping you choose + the best version for your deployment. - List all operations provided by Microsoft.Elastic. + Retrieve a list of all available Elastic versions for a specified region, helping you choose + the best version for your deployment. - :return: An iterator like instance of either OperationResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.OperationResult] + :keyword region: Region where elastic deployment will take place. Required. + :paramtype region: str + :return: An iterator like instance of ElasticVersionListFormat + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticVersionListFormat] :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.ElasticVersionListFormat]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -102,12 +7000,19 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.OperationResult"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_elastic_versions_list_request( + subscription_id=self._config.subscription_id, + region=region, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _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 @@ -120,18 +7025,29 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.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.ElasticVersionListFormat], + 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) @@ -144,8 +7060,9 @@ def get_next(next_link=None): 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.ResourceProviderDefaultErrorResponse, pipeline_response + error = _failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py deleted file mode 100644 index 9b0ba34ffab8..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py +++ /dev/null @@ -1,542 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_api_key_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - 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.Elastic/getOrganizationApiKey" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_elastic_to_azure_subscription_mapping_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getElasticOrganizationToAzureSubscriptionMapping", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_resubscribe_request( - resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - 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.Elastic/monitors/{monitorName}/resubscribe", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _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 OrganizationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`organizations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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 get_api_key( - self, body: Optional[_models.UserEmailId] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UserApiKeyResponse: - """Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - :param body: Email Id parameter of the User Organization, of which the API Key must be - returned. Default value is None. - :type body: ~azure.mgmt.elastic.models.UserEmailId - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UserApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def get_api_key( - self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UserApiKeyResponse: - """Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - :param body: Email Id parameter of the User Organization, of which the API Key must be - returned. 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: UserApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def get_api_key( - self, body: Optional[Union[_models.UserEmailId, IO[bytes]]] = None, **kwargs: Any - ) -> _models.UserApiKeyResponse: - """Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - Fetch the User API Key from the internal database, if it was generated and stored during the - creation of the Elasticsearch Organization. - - :param body: Email Id parameter of the User Organization, of which the API Key must be - returned. Is either a UserEmailId type or a IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.UserEmailId or IO[bytes] - :return: UserApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[_models.UserApiKeyResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UserEmailId") - else: - _json = None - - _request = build_get_api_key_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UserApiKeyResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_elastic_to_azure_subscription_mapping( # pylint: disable=name-too-long - self, **kwargs: Any - ) -> _models.ElasticOrganizationToAzureSubscriptionMappingResponse: - """Retrieve mapping details between the Elastic Organization and Azure Subscription for the - logged-in user. - - Retrieve mapping details between the Elastic Organization and Azure Subscription for the - logged-in user. - - :return: ElasticOrganizationToAzureSubscriptionMappingResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse - :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 = 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.ElasticOrganizationToAzureSubscriptionMappingResponse] = kwargs.pop("cls", None) - - _request = build_get_elastic_to_azure_subscription_mapping_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ElasticOrganizationToAzureSubscriptionMappingResponse", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _resubscribe_initial( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ResubscribeProperties, IO[bytes]]] = 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 = case_insensitive_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)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "ResubscribeProperties") - else: - _json = None - - _request = build_resubscribe_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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 = 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["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_resubscribe( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.ResubscribeProperties] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ElasticMonitorResource]: - """Resubscribe the Elasticsearch Organization. - - Resubscribe the Elasticsearch Organization. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Resubscribe Properties. Default value is None. - :type body: ~azure.mgmt.elastic.models.ResubscribeProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_resubscribe( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ElasticMonitorResource]: - """Resubscribe the Elasticsearch Organization. - - Resubscribe the Elasticsearch Organization. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Resubscribe Properties. 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: An instance of LROPoller that returns either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_resubscribe( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.ResubscribeProperties, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.ElasticMonitorResource]: - """Resubscribe the Elasticsearch Organization. - - Resubscribe the Elasticsearch Organization. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: Resubscribe Properties. Is either a ResubscribeProperties type or a IO[bytes] - type. Default value is None. - :type body: ~azure.mgmt.elastic.models.ResubscribeProperties or IO[bytes] - :return: An instance of LROPoller that returns either ElasticMonitorResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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)) - content_type = content_type if body else None - cls: ClsType[_models.ElasticMonitorResource] = 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._resubscribe_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - body=body, - api_version=api_version, - 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): - deserialized = self._deserialize("ElasticMonitorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ElasticMonitorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ElasticMonitorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_patch.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_patch.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# 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 """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py deleted file mode 100644 index 28ad1d410905..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py +++ /dev/null @@ -1,629 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, monitor_name: str, rule_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - 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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, "str", pattern=r"^.*$"), - } - - _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_get_request( - resource_group_name: str, monitor_name: str, rule_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, "str", pattern=r"^.*$"), - } - - _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_delete_request( - resource_group_name: str, monitor_name: str, rule_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class TagRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`tag_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> ItemPaged["_models.MonitoringTagRules"]: - """List all tag rules for a given Elastic monitor resource, helping you manage fine-grained - control over observability based on resource tags. - - List all tag rules for a given Elastic monitor resource, helping you manage fine-grained - control over observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either MonitoringTagRules or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.MonitoringTagRules] - :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.MonitoringTagRulesListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MonitoringTagRulesListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - rule_set_name: str, - body: Optional[_models.MonitoringTagRules] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MonitoringTagRules: - """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :param body: request body of MonitoringTagRules. Default value is None. - :type body: ~azure.mgmt.elastic.models.MonitoringTagRules - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MonitoringTagRules or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - rule_set_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MonitoringTagRules: - """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :param body: request body of MonitoringTagRules. 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: MonitoringTagRules or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - monitor_name: str, - rule_set_name: str, - body: Optional[Union[_models.MonitoringTagRules, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.MonitoringTagRules: - """Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained - control over observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :param body: request body of MonitoringTagRules. Is either a MonitoringTagRules type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.elastic.models.MonitoringTagRules or IO[bytes] - :return: MonitoringTagRules or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "MonitoringTagRules") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MonitoringTagRules", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, monitor_name: str, rule_set_name: str, **kwargs: Any - ) -> _models.MonitoringTagRules: - """Get detailed information about a tag rule set for a given Elastic monitor resource. - - Get detailed information about a tag rule set for a given Elastic monitor resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :return: MonitoringTagRules or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.MonitoringTagRules - :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 = 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.MonitoringTagRules] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MonitoringTagRules", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, monitor_name: str, rule_set_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _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, 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 = self._deserialize.failsafe_deserialize( - _models.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, monitor_name: str, rule_set_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over - observability based on resource tags. - - Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over - observability based on resource tags. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param rule_set_name: Tag Rule Set resource name. Required. - :type rule_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - api_version=api_version, - 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 - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py deleted file mode 100644 index 60389af2e5d7..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py +++ /dev/null @@ -1,159 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, - monitor_name: str, - subscription_id: str, - *, - ruleset_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/deleteTrafficFilter", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if ruleset_id is not None: - _params["rulesetId"] = _SERIALIZER.query("ruleset_id", ruleset_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class TrafficFiltersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`traffic_filters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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 delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, monitor_name: str, ruleset_id: Optional[str] = None, **kwargs: Any - ) -> None: - """Delete an existing traffic filter associated with your Elastic monitor resource, removing its - network traffic control capabilities. - - Delete an existing traffic filter associated with your Elastic monitor resource, removing its - network traffic control capabilities. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param ruleset_id: Ruleset Id of the filter. Default value is None. - :type ruleset_id: str - :return: None or the result of cls(response) - :rtype: None - :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 = 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, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - ruleset_id=ruleset_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py deleted file mode 100644 index e1bdd0cee1f8..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py +++ /dev/null @@ -1,151 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_details_request( - resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listUpgradableVersions", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class UpgradableVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`upgradable_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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 details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.UpgradableVersionsList: - """List all upgradable versions for your Elastic monitor resource, helping you plan and execute - upgrades. - - List all upgradable versions for your Elastic monitor resource, helping you plan and execute - upgrades. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: UpgradableVersionsList or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.UpgradableVersionsList - :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 = 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.UpgradableVersionsList] = kwargs.pop("cls", None) - - _request = build_details_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpgradableVersionsList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py deleted file mode 100644 index d3cb34dfce7f..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py +++ /dev/null @@ -1,238 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_update_request( - resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - 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.Elastic/monitors/{monitorName}/vmCollectionUpdate", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _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 VMCollectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`vm_collection` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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 update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[_models.VMCollectionUpdate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: VM resource Id. Default value is None. - :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - monitor_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: VM resource Id. 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: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - monitor_name: str, - body: Optional[Union[_models.VMCollectionUpdate, IO[bytes]]] = None, - **kwargs: Any - ) -> None: - """Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal - observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :param body: VM resource Id. Is either a VMCollectionUpdate type or a IO[bytes] type. Default - value is None. - :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate or IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :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 = 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)) - content_type = content_type if body else None - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "VMCollectionUpdate") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py deleted file mode 100644 index 1a676871db4c..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py +++ /dev/null @@ -1,177 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -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.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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listVMHost", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class VMHostOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`vm_host` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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, resource_group_name: str, monitor_name: str, **kwargs: Any) -> ItemPaged["_models.VMResources"]: - """List all VM resources currently being monitored by the Elastic monitor resource, helping you - manage observability. - - List all VM resources currently being monitored by the Elastic monitor resource, helping you - manage observability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: An iterator like instance of either VMResources or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.VMResources] - :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.VMHostListResponse] = 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_list_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VMHostListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py deleted file mode 100644 index 89b37be26ba3..000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py +++ /dev/null @@ -1,151 +0,0 @@ -# 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. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 .. import models as _models -from .._configuration import MicrosoftElasticConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_details_request( - resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails", - ) - 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 - ), - "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str", pattern=r"^.*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class VMIngestionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.elastic.MicrosoftElastic`'s - :attr:`vm_ingestion` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftElasticConfiguration = 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 details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.VMIngestionDetailsResponse: - """List detailed information about VM ingestion that will be monitored by the Elastic monitor - resource, ensuring optimal observability and performance. - - List detailed information about VM ingestion that will be monitored by the Elastic monitor - resource, ensuring optimal observability and performance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param monitor_name: Monitor resource name. Required. - :type monitor_name: str - :return: VMIngestionDetailsResponse or the result of cls(response) - :rtype: ~azure.mgmt.elastic.models.VMIngestionDetailsResponse - :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 = 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.VMIngestionDetailsResponse] = kwargs.pop("cls", None) - - _request = build_details_request( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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.ResourceProviderDefaultErrorResponse, pipeline_response - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VMIngestionDetailsResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/types.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/types.py new file mode 100644 index 000000000000..190444250e25 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/types.py @@ -0,0 +1,1331 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +if TYPE_CHECKING: + from .models import ( + ConfigurationType, + CreatedByType, + ElasticDeploymentStatus, + HostingType, + LiftrResourceCategories, + ManagedIdentityTypes, + MonitoringStatus, + Operation, + OperationName, + ProjectType, + ProvisioningState, + SendingLogs, + Status, + TagAction, + Type, + ) + + +class BillingInfoResponse(TypedDict, total=False): + """Marketplace Subscription and Organization details to which resource gets billed into. + + :ivar marketplace_saas_info: Marketplace Subscription details. + :vartype marketplace_saas_info: "MarketplaceSaaSInfo" + :ivar partner_billing_entity: Partner Billing Entity details: Organization Info. + :vartype partner_billing_entity: "PartnerBillingEntity" + """ + + marketplaceSaasInfo: "MarketplaceSaaSInfo" + """Marketplace Subscription details.""" + partnerBillingEntity: "PartnerBillingEntity" + """Partner Billing Entity details: Organization Info.""" + + +class CompanyInfo(TypedDict, total=False): + """Company information of the user to be passed to partners. + + :ivar domain: Domain of the company. + :vartype domain: str + :ivar business: Business of the company. + :vartype business: str + :ivar employees_number: Number of employees in the company. + :vartype employees_number: str + :ivar state: State of the company location. + :vartype state: str + :ivar country: Country of the company location. + :vartype country: str + """ + + domain: str + """Domain of the company.""" + business: str + """Business of the company.""" + employeesNumber: str + """Number of employees in the company.""" + state: str + """State of the company location.""" + country: str + """Country of the company location.""" + + +class ConnectedPartnerResourceProperties(TypedDict, total=False): + """Connected Partner Resource Properties. + + :ivar partner_deployment_name: Elastic resource name. + :vartype partner_deployment_name: str + :ivar partner_deployment_uri: URL of the resource in Elastic cloud. + :vartype partner_deployment_uri: str + :ivar azure_resource_id: The azure resource Id of the resource. + :vartype azure_resource_id: str + :ivar location: The location of the resource. + :vartype location: str + :ivar type: The hosting type of the resource. + :vartype type: str + """ + + partnerDeploymentName: str + """Elastic resource name.""" + partnerDeploymentUri: str + """URL of the resource in Elastic cloud.""" + azureResourceId: str + """The azure resource Id of the resource.""" + location: str + """The location of the resource.""" + type: str + """The hosting type of the resource.""" + + +class ConnectedPartnerResourcesListFormat(TypedDict, total=False): + """Connected Partner Resources List Format. + + :ivar properties: Connected Partner Resource Properties. + :vartype properties: "ConnectedPartnerResourceProperties" + """ + + properties: "ConnectedPartnerResourceProperties" + """Connected Partner Resource Properties.""" + + +class DeploymentInfoResponse(TypedDict, total=False): + """The properties of deployment in Elastic cloud corresponding to the Elastic monitor resource. + + :ivar status: The Elastic deployment status. Known values are: "Healthy" and "Unhealthy". + :vartype status: Union[str, "ElasticDeploymentStatus"] + :ivar version: Version of the elasticsearch in Elastic cloud deployment. + :vartype version: str + :ivar memory_capacity: RAM capacity of the elasticsearch in Elastic cloud deployment. + :vartype memory_capacity: str + :ivar disk_capacity: Disk capacity of the elasticsearch in Elastic cloud deployment. + :vartype disk_capacity: str + :ivar elasticsearch_end_point: Elasticsearch endpoint in Elastic cloud deployment. This is + either the aliased_endpoint if available, or the service_url otherwise. + :vartype elasticsearch_end_point: str + :ivar deployment_url: Deployment URL of the elasticsearch in Elastic cloud deployment. + :vartype deployment_url: str + :ivar marketplace_saas_info: Marketplace SaaS Info of the resource. + :vartype marketplace_saas_info: "MarketplaceSaaSInfo" + :ivar project_type: Project Type - Applicable for Serverless only. + :vartype project_type: str + :ivar configuration_type: ConfigurationType Type - Applicable for Serverless only. + :vartype configuration_type: str + """ + + status: Union[str, "ElasticDeploymentStatus"] + """The Elastic deployment status. Known values are: \"Healthy\" and \"Unhealthy\".""" + version: str + """Version of the elasticsearch in Elastic cloud deployment.""" + memoryCapacity: str + """RAM capacity of the elasticsearch in Elastic cloud deployment.""" + diskCapacity: str + """Disk capacity of the elasticsearch in Elastic cloud deployment.""" + elasticsearchEndPoint: str + """Elasticsearch endpoint in Elastic cloud deployment. This is either the aliased_endpoint if + available, or the service_url otherwise.""" + deploymentUrl: str + """Deployment URL of the elasticsearch in Elastic cloud deployment.""" + marketplaceSaasInfo: "MarketplaceSaaSInfo" + """Marketplace SaaS Info of the resource.""" + projectType: str + """Project Type - Applicable for Serverless only.""" + configurationType: str + """ConfigurationType Type - Applicable for Serverless only.""" + + +class ElasticCloudDeployment(TypedDict, total=False): + """Details of the user's elastic deployment associated with the monitor resource. + + :ivar name: Elastic deployment name. + :vartype name: str + :ivar deployment_id: Elastic deployment Id. + :vartype deployment_id: str + :ivar azure_subscription_id: Associated Azure subscription Id for the elastic deployment. + :vartype azure_subscription_id: str + :ivar elasticsearch_region: Region where Deployment at Elastic side took place. + :vartype elasticsearch_region: str + :ivar elasticsearch_service_url: Elasticsearch ingestion endpoint of the Elastic deployment. + :vartype elasticsearch_service_url: str + :ivar kibana_service_url: Kibana endpoint of the Elastic deployment. + :vartype kibana_service_url: str + :ivar kibana_sso_url: Kibana dashboard sso URL of the Elastic deployment. + :vartype kibana_sso_url: str + """ + + name: str + """Elastic deployment name.""" + deploymentId: str + """Elastic deployment Id.""" + azureSubscriptionId: str + """Associated Azure subscription Id for the elastic deployment.""" + elasticsearchRegion: str + """Region where Deployment at Elastic side took place.""" + elasticsearchServiceUrl: str + """Elasticsearch ingestion endpoint of the Elastic deployment.""" + kibanaServiceUrl: str + """Kibana endpoint of the Elastic deployment.""" + kibanaSsoUrl: str + """Kibana dashboard sso URL of the Elastic deployment.""" + + +class ElasticCloudUser(TypedDict, total=False): + """Details of the user's elastic account. + + :ivar email_address: Email of the Elastic User Account. + :vartype email_address: str + :ivar id: User Id of the elastic account of the User. + :vartype id: str + :ivar elastic_cloud_sso_default_url: Elastic cloud default dashboard sso URL of the Elastic + user account. + :vartype elastic_cloud_sso_default_url: str + """ + + emailAddress: str + """Email of the Elastic User Account.""" + id: str + """User Id of the elastic account of the User.""" + elasticCloudSsoDefaultUrl: str + """Elastic cloud default dashboard sso URL of the Elastic user account.""" + + +class Resource(TypedDict, total=False): + """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: "SystemData" + """ + + id: str + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: str + """The name of the resource.""" + type: str + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + systemData: "SystemData" + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """Tracked 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: "SystemData" + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: dict[str, str] + """Resource tags.""" + location: Required[str] + """The geo-location where the resource lives. Required.""" + + +class ElasticMonitorResource(TrackedResource): + """Monitor 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: "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: Properties of the monitor resource. + :vartype properties: "MonitorProperties" + :ivar kind: The kind of the Elastic resource - observability, security, search etc. + :vartype kind: str + :ivar sku: SKU of the monitor resource. + :vartype sku: "ResourceSku" + :ivar identity: Identity properties of the monitor resource. + :vartype identity: "IdentityProperties" + """ + + properties: "MonitorProperties" + """Properties of the monitor resource.""" + kind: str + """The kind of the Elastic resource - observability, security, search etc.""" + sku: "ResourceSku" + """SKU of the monitor resource.""" + identity: "IdentityProperties" + """Identity properties of the monitor resource.""" + + +class ElasticMonitorResourceUpdateParameters(TypedDict, total=False): + """Monitor resource update parameters. + + :ivar tags: elastic monitor resource tags. + :vartype tags: dict[str, str] + """ + + tags: dict[str, str] + """elastic monitor resource tags.""" + + +class ElasticMonitorUpgrade(TypedDict, total=False): + """Upgrade elastic monitor version. + + :ivar version: Version to which the elastic monitor should be upgraded to. + :vartype version: str + """ + + version: str + """Version to which the elastic monitor should be upgraded to.""" + + +class ElasticOrganizationToAzureSubscriptionMappingResponse(TypedDict, total=False): # pylint: disable=name-too-long + """The Azure Subscription ID to which the Organization of the logged in user belongs and gets + billed into. + + :ivar properties: The properties of Azure Subscription ID to which the Organization of the + logged in user belongs and gets billed into. + :vartype properties: "ElasticOrganizationToAzureSubscriptionMappingResponseProperties" + """ + + properties: "ElasticOrganizationToAzureSubscriptionMappingResponseProperties" + """The properties of Azure Subscription ID to which the Organization of the logged in user belongs + and gets billed into.""" + + +class ElasticOrganizationToAzureSubscriptionMappingResponseProperties( + TypedDict, total=False +): # pylint: disable=name-too-long + """The properties of Azure Subscription ID to which the Organization of the logged in user belongs + and gets billed into. + + :ivar billed_azure_subscription_id: The Azure Subscription ID to which the Organization belongs + and gets billed into. This is empty for a new user OR a user without an Elastic Organization. + :vartype billed_azure_subscription_id: str + :ivar marketplace_saas_info: Marketplace SaaS Info of the resource. + :vartype marketplace_saas_info: "MarketplaceSaaSInfo" + :ivar elastic_organization_id: The Elastic Organization Id. + :vartype elastic_organization_id: str + :ivar elastic_organization_name: The Elastic Organization Name. + :vartype elastic_organization_name: str + """ + + billedAzureSubscriptionId: str + """The Azure Subscription ID to which the Organization belongs and gets billed into. This is empty + for a new user OR a user without an Elastic Organization.""" + marketplaceSaasInfo: "MarketplaceSaaSInfo" + """Marketplace SaaS Info of the resource.""" + elasticOrganizationId: str + """The Elastic Organization Id.""" + elasticOrganizationName: str + """The Elastic Organization Name.""" + + +class ElasticProperties(TypedDict, total=False): + """Elastic Resource Properties. + + :ivar elastic_cloud_user: Details of the user's elastic account. + :vartype elastic_cloud_user: "ElasticCloudUser" + :ivar elastic_cloud_deployment: Details of the elastic cloud deployment. + :vartype elastic_cloud_deployment: "ElasticCloudDeployment" + """ + + elasticCloudUser: "ElasticCloudUser" + """Details of the user's elastic account.""" + elasticCloudDeployment: "ElasticCloudDeployment" + """Details of the elastic cloud deployment.""" + + +class ElasticTrafficFilter(TypedDict, total=False): + """Elastic traffic filter object. + + :ivar id: Id of the elastic filter. + :vartype id: str + :ivar name: Name of the elastic filter. + :vartype name: str + :ivar description: Description of the elastic filter. + :vartype description: str + :ivar region: Region of the elastic filter. + :vartype region: str + :ivar type: Type of the elastic filter. Known values are: "ip" and "azure_private_endpoint". + :vartype type: Union[str, "Type"] + :ivar include_by_default: IncludeByDefault for the elastic filter. + :vartype include_by_default: bool + :ivar rules: Rules in the elastic filter. + :vartype rules: list["ElasticTrafficFilterRule"] + """ + + id: str + """Id of the elastic filter.""" + name: str + """Name of the elastic filter.""" + description: str + """Description of the elastic filter.""" + region: str + """Region of the elastic filter.""" + type: Union[str, "Type"] + """Type of the elastic filter. Known values are: \"ip\" and \"azure_private_endpoint\".""" + includeByDefault: bool + """IncludeByDefault for the elastic filter.""" + rules: list["ElasticTrafficFilterRule"] + """Rules in the elastic filter.""" + + +class ElasticTrafficFilterResponse(TypedDict, total=False): + """List of elastic traffic filters in the account. + + :ivar rulesets: List of elastic traffic filters in the account. + :vartype rulesets: list["ElasticTrafficFilter"] + """ + + rulesets: list["ElasticTrafficFilter"] + """List of elastic traffic filters in the account.""" + + +class ElasticTrafficFilterRule(TypedDict, total=False): + """Elastic traffic filter rule object. + + :ivar source: IP of the elastic filter rule. + :vartype source: str + :ivar description: Description of the elastic filter rule. + :vartype description: str + :ivar azure_endpoint_guid: Guid of Private Endpoint in the elastic filter rule. + :vartype azure_endpoint_guid: str + :ivar azure_endpoint_name: Name of the Private Endpoint in the elastic filter rule. + :vartype azure_endpoint_name: str + :ivar id: Id of the elastic filter rule. + :vartype id: str + """ + + source: str + """IP of the elastic filter rule.""" + description: str + """Description of the elastic filter rule.""" + azureEndpointGuid: str + """Guid of Private Endpoint in the elastic filter rule.""" + azureEndpointName: str + """Name of the Private Endpoint in the elastic filter rule.""" + id: str + """Id of the elastic filter rule.""" + + +class ElasticVersionListFormat(TypedDict, total=False): + """Elastic Version List Format. + + :ivar properties: Elastic Version Properties. + :vartype properties: "ElasticVersionListProperties" + """ + + properties: "ElasticVersionListProperties" + """Elastic Version Properties.""" + + +class ElasticVersionListProperties(TypedDict, total=False): + """Elastic Version Properties. + + :ivar version: Available elastic version of the given region. + :vartype version: str + """ + + version: str + """Available elastic version of the given region.""" + + +class ErrorAdditionalInfo(TypedDict, total=False): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: Any + """ + + type: str + """The additional info type.""" + info: Any + """The additional info.""" + + +class ErrorDetail(TypedDict, total=False): + """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["ErrorDetail"] + :ivar additional_info: The error additional info. + :vartype additional_info: list["ErrorAdditionalInfo"] + """ + + code: str + """The error code.""" + message: str + """The error message.""" + target: str + """The error target.""" + details: list["ErrorDetail"] + """The error details.""" + additionalInfo: list["ErrorAdditionalInfo"] + """The error additional info.""" + + +class ErrorResponse(TypedDict, total=False): + """Error response. + + :ivar error: The error object. + :vartype error: "ErrorDetail" + """ + + error: "ErrorDetail" + """The error object.""" + + +class ErrorResponseBody(TypedDict, total=False): + """Error response body. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar target: Error target. + :vartype target: str + :ivar details: Error details. + :vartype details: list["ErrorResponseBody"] + """ + + code: str + """Error code.""" + message: str + """Error message.""" + target: str + """Error target.""" + details: list["ErrorResponseBody"] + """Error details.""" + + +class ExternalUserCreationResponse(TypedDict, total=False): + """The properties of the response we got from elastic while creating external user. + + :ivar created: Shows if user is created or updated. + :vartype created: bool + """ + + created: bool + """Shows if user is created or updated.""" + + +class ExternalUserInfo(TypedDict, total=False): + """The properties of the request required for creating user on elastic side. + + :ivar user_name: Username of the user to be created or updated. + :vartype user_name: str + :ivar full_name: Full name of the user to be created or updated. + :vartype full_name: str + :ivar password: Password of the user to be created or updated. + :vartype password: str + :ivar email_id: Email id of the user to be created or updated. + :vartype email_id: str + :ivar roles: Roles to be assigned for created or updated user. + :vartype roles: list[str] + """ + + userName: str + """Username of the user to be created or updated.""" + fullName: str + """Full name of the user to be created or updated.""" + password: str + """Password of the user to be created or updated.""" + emailId: str + """Email id of the user to be created or updated.""" + roles: list[str] + """Roles to be assigned for created or updated user.""" + + +class FilteringTag(TypedDict, total=False): + """The definition of a filtering tag. Filtering tags are used for capturing resources and + include/exclude them from being monitored. + + :ivar name: The name (also known as the key) of the tag. + :vartype name: str + :ivar value: The value of the tag. + :vartype value: str + :ivar action: Valid actions for a filtering tag. Known values are: "Include" and "Exclude". + :vartype action: Union[str, "TagAction"] + """ + + name: str + """The name (also known as the key) of the tag.""" + value: str + """The value of the tag.""" + action: Union[str, "TagAction"] + """Valid actions for a filtering tag. Known values are: \"Include\" and \"Exclude\".""" + + +class IdentityProperties(TypedDict, total=False): + """Identity properties. + + :ivar principal_id: The identity ID. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: Managed identity type. "SystemAssigned" + :vartype type: Union[str, "ManagedIdentityTypes"] + """ + + principalId: str + """The identity ID.""" + tenantId: str + """The tenant ID of resource.""" + type: Union[str, "ManagedIdentityTypes"] + """Managed identity type. \"SystemAssigned\"""" + + +class LogRules(TypedDict, total=False): + """Set of rules for sending logs for the Monitor resource. + + :ivar send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :vartype send_aad_logs: bool + :ivar send_subscription_logs: Flag specifying if subscription logs should be sent for the + Monitor resource. + :vartype send_subscription_logs: bool + :ivar send_activity_logs: Flag specifying if activity logs from Azure resources should be sent + for the Monitor resource. + :vartype send_activity_logs: bool + :ivar filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :vartype filtering_tags: list["FilteringTag"] + """ + + sendAadLogs: bool + """Flag specifying if AAD logs should be sent for the Monitor resource.""" + sendSubscriptionLogs: bool + """Flag specifying if subscription logs should be sent for the Monitor resource.""" + sendActivityLogs: bool + """Flag specifying if activity logs from Azure resources should be sent for the Monitor resource.""" + filteringTags: list["FilteringTag"] + """List of filtering tags to be used for capturing logs. This only takes effect if + SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude + action is specified, the rules will apply to the list of all available resources. If Include + actions are specified, the rules will only include resources with the associated tags.""" + + +class MarketplaceSaaSInfo(TypedDict, total=False): + """Marketplace SAAS Info of the resource. + + :ivar marketplace_subscription: Marketplace Subscription. + :vartype marketplace_subscription: "MarketplaceSaaSInfoMarketplaceSubscription" + :ivar marketplace_name: Marketplace Subscription Details: SAAS Name. + :vartype marketplace_name: str + :ivar marketplace_resource_id: Marketplace Subscription Details: Resource URI. + :vartype marketplace_resource_id: str + :ivar marketplace_status: Marketplace Subscription Details: SaaS Subscription Status. + :vartype marketplace_status: str + :ivar billed_azure_subscription_id: The Azure Subscription ID to which the Marketplace + Subscription belongs and gets billed into. + :vartype billed_azure_subscription_id: str + :ivar subscribed: Flag specifying if the Marketplace status is subscribed or not. + :vartype subscribed: bool + """ + + marketplaceSubscription: "MarketplaceSaaSInfoMarketplaceSubscription" + """Marketplace Subscription.""" + marketplaceName: str + """Marketplace Subscription Details: SAAS Name.""" + marketplaceResourceId: str + """Marketplace Subscription Details: Resource URI.""" + marketplaceStatus: str + """Marketplace Subscription Details: SaaS Subscription Status.""" + billedAzureSubscriptionId: str + """The Azure Subscription ID to which the Marketplace Subscription belongs and gets billed into.""" + subscribed: bool + """Flag specifying if the Marketplace status is subscribed or not.""" + + +class MarketplaceSaaSInfoMarketplaceSubscription(TypedDict, total=False): # pylint: disable=name-too-long + """Marketplace Subscription. + + :ivar id: Marketplace Subscription Id. This is a GUID-formatted string. + :vartype id: str + :ivar publisher_id: Publisher Id of the Marketplace offer. + :vartype publisher_id: str + :ivar offer_id: Offer Id of the Marketplace offer,. + :vartype offer_id: str + """ + + id: str + """Marketplace Subscription Id. This is a GUID-formatted string.""" + publisherId: str + """Publisher Id of the Marketplace offer.""" + offerId: str + """Offer Id of the Marketplace offer,.""" + + +class MonitoredResource(TypedDict, total=False): + """The properties of a resource currently being monitored by the Elastic monitor resource. + + :ivar id: The ARM id of the resource. + :vartype id: str + :ivar sending_logs: Flag indicating the status of the resource for sending logs operation to + Elastic. Known values are: "True" and "False". + :vartype sending_logs: Union[str, "SendingLogs"] + :ivar reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + sending). + :vartype reason_for_logs_status: str + """ + + id: str + """The ARM id of the resource.""" + sendingLogs: Union[str, "SendingLogs"] + """Flag indicating the status of the resource for sending logs operation to Elastic. Known values + are: \"True\" and \"False\".""" + reasonForLogsStatus: str + """Reason for why the resource is sending logs (or why it is not sending).""" + + +class MonitoredSubscription(TypedDict, total=False): + """The list of subscriptions and it's monitoring status by current Elastic monitor. + + :ivar subscription_id: The subscriptionId to be monitored. Required. + :vartype subscription_id: str + :ivar status: The state of monitoring. Known values are: "InProgress", "Active", "Failed", and + "Deleting". + :vartype status: Union[str, "Status"] + :ivar error: The reason of not monitoring the subscription. + :vartype error: str + :ivar tag_rules: Definition of the properties for a TagRules resource. + :vartype tag_rules: "MonitoringTagRulesProperties" + """ + + subscriptionId: Required[str] + """The subscriptionId to be monitored. Required.""" + status: Union[str, "Status"] + """The state of monitoring. Known values are: \"InProgress\", \"Active\", \"Failed\", and + \"Deleting\".""" + error: str + """The reason of not monitoring the subscription.""" + tagRules: "MonitoringTagRulesProperties" + """Definition of the properties for a TagRules resource.""" + + +class ProxyResource(Resource): + """Proxy 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: "SystemData" + """ + + +class MonitoredSubscriptionProperties(ProxyResource): + """The request to update subscriptions needed to be monitored by the Elastic monitor 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: "SystemData" + :ivar properties: The request to update subscriptions needed to be monitored by the Elastic + monitor resource. + :vartype properties: "SubscriptionList" + """ + + properties: "SubscriptionList" + """The request to update subscriptions needed to be monitored by the Elastic monitor resource.""" + + +class MonitoringTagRules(ProxyResource): + """Capture logs and metrics of Azure resources based on ARM tags. + + :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: "SystemData" + :ivar properties: Properties of the monitoring tag rules. + :vartype properties: "MonitoringTagRulesProperties" + """ + + properties: "MonitoringTagRulesProperties" + """Properties of the monitoring tag rules.""" + + +class MonitoringTagRulesProperties(TypedDict, total=False): + """Definition of the properties for a TagRules resource. + + :ivar provisioning_state: Provisioning state of the monitoring tag rules. Known values are: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + and "NotSpecified". + :vartype provisioning_state: Union[str, "ProvisioningState"] + :ivar log_rules: Rules for sending logs. + :vartype log_rules: "LogRules" + """ + + provisioningState: Union[str, "ProvisioningState"] + """Provisioning state of the monitoring tag rules. Known values are: \"Accepted\", \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and + \"NotSpecified\".""" + logRules: "LogRules" + """Rules for sending logs.""" + + +class MonitorProperties(TypedDict, total=False): + """Properties specific to the monitor resource. + + :ivar provisioning_state: Provisioning state of the monitor resource. Known values are: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + and "NotSpecified". + :vartype provisioning_state: Union[str, "ProvisioningState"] + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Known values are: "Enabled" and "Disabled". + :vartype monitoring_status: Union[str, "MonitoringStatus"] + :ivar elastic_properties: Elastic cloud properties. + :vartype elastic_properties: "ElasticProperties" + :ivar user_info: User information. + :vartype user_info: "UserInfo" + :ivar plan_details: Plan details of the monitor resource. + :vartype plan_details: "PlanDetails" + :ivar version: Version of elastic of the monitor resource. + :vartype version: str + :ivar subscription_state: State of the Azure Subscription containing the monitor resource. + :vartype subscription_state: str + :ivar saa_s_azure_subscription_status: Status of Azure Subscription where Marketplace SaaS is + located. + :vartype saa_s_azure_subscription_status: str + :ivar source_campaign_name: Name of the marketing campaign. + :vartype source_campaign_name: str + :ivar source_campaign_id: A unique identifier associated with the campaign. + :vartype source_campaign_id: str + :ivar liftr_resource_category: Known values are: "Unknown" and "MonitorLogs". + :vartype liftr_resource_category: Union[str, "LiftrResourceCategories"] + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + :ivar generate_api_key: Flag to determine if User API Key has to be generated and shared. + :vartype generate_api_key: bool + :ivar hosting_type: Hosting type of the monitor resource - either Hosted deployments OR + Serverless Projects. Known values are: "Hosted" and "Serverless". + :vartype hosting_type: Union[str, "HostingType"] + :ivar project_details: Project details of the monitor resource IF it belongs to Serverless + offer kind. + :vartype project_details: "ProjectDetails" + """ + + provisioningState: Union[str, "ProvisioningState"] + """Provisioning state of the monitor resource. Known values are: \"Accepted\", \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and + \"NotSpecified\".""" + monitoringStatus: Union[str, "MonitoringStatus"] + """Flag specifying if the resource monitoring is enabled or disabled. Known values are: + \"Enabled\" and \"Disabled\".""" + elasticProperties: "ElasticProperties" + """Elastic cloud properties.""" + userInfo: "UserInfo" + """User information.""" + planDetails: "PlanDetails" + """Plan details of the monitor resource.""" + version: str + """Version of elastic of the monitor resource.""" + subscriptionState: str + """State of the Azure Subscription containing the monitor resource.""" + saaSAzureSubscriptionStatus: str + """Status of Azure Subscription where Marketplace SaaS is located.""" + sourceCampaignName: str + """Name of the marketing campaign.""" + sourceCampaignId: str + """A unique identifier associated with the campaign.""" + liftrResourceCategory: Union[str, "LiftrResourceCategories"] + """Known values are: \"Unknown\" and \"MonitorLogs\".""" + liftrResourcePreference: int + """The priority of the resource.""" + generateApiKey: bool + """Flag to determine if User API Key has to be generated and shared.""" + hostingType: Union[str, "HostingType"] + """Hosting type of the monitor resource - either Hosted deployments OR Serverless Projects. Known + values are: \"Hosted\" and \"Serverless\".""" + projectDetails: "ProjectDetails" + """Project details of the monitor resource IF it belongs to Serverless offer kind.""" + + +class OpenAIIntegrationProperties(TypedDict, total=False): + """Open AI Integration details. + + :ivar open_ai_resource_id: The resource name of Open AI resource. + :vartype open_ai_resource_id: str + :ivar open_ai_resource_endpoint: The API endpoint for Open AI resource. + :vartype open_ai_resource_endpoint: str + :ivar open_ai_connector_id: The connector id of Open AI resource. + :vartype open_ai_connector_id: str + :ivar key: Value of API key for Open AI resource. + :vartype key: str + :ivar last_refresh_at: Last Update Timestamp for key updation. + :vartype last_refresh_at: str + """ + + openAIResourceId: str + """The resource name of Open AI resource.""" + openAIResourceEndpoint: str + """The API endpoint for Open AI resource.""" + openAIConnectorId: str + """The connector id of Open AI resource.""" + key: str + """Value of API key for Open AI resource.""" + lastRefreshAt: str + """Last Update Timestamp for key updation.""" + + +class OpenAIIntegrationRPModel(ProxyResource): + """Capture properties of Open AI resource Integration. + + :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: "SystemData" + :ivar properties: Open AI Integration details. + :vartype properties: "OpenAIIntegrationProperties" + """ + + properties: "OpenAIIntegrationProperties" + """Open AI Integration details.""" + + +class OpenAIIntegrationStatusResponse(TypedDict, total=False): + """Status of the OpenAI Integration. + + :ivar properties: Status of the OpenAI Integration. + :vartype properties: "OpenAIIntegrationStatusResponseProperties" + """ + + properties: "OpenAIIntegrationStatusResponseProperties" + """Status of the OpenAI Integration.""" + + +class OpenAIIntegrationStatusResponseProperties(TypedDict, total=False): # pylint: disable=name-too-long + """Status of the OpenAI Integration. + + :ivar status: Status of the OpenAI Integration. + :vartype status: str + """ + + status: str + """Status of the OpenAI Integration.""" + + +class OperationDisplay(TypedDict, total=False): + """Represents the display information for an operation. + + :ivar provider: The service provider of the operation. + :vartype provider: str + :ivar resource: The resource type of the operation. + :vartype resource: str + :ivar operation: The name of the operation. + :vartype operation: str + :ivar description: A description of the operation. + :vartype description: str + """ + + provider: str + """The service provider of the operation.""" + resource: str + """The resource type of the operation.""" + operation: str + """The name of the operation.""" + description: str + """A description of the operation.""" + + +class OperationResult(TypedDict, total=False): + """A Microsoft.Elastic REST API operation. + + :ivar name: Operation name, i.e., {provider}/{resource}/{operation}. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: The object that represents the operation. + :vartype display: "OperationDisplay" + :ivar origin: Origin of the operation. + :vartype origin: str + """ + + name: str + """Operation name, i.e., {provider}/{resource}/{operation}.""" + isDataAction: bool + """Indicates whether the operation is a data action.""" + display: "OperationDisplay" + """The object that represents the operation.""" + origin: str + """Origin of the operation.""" + + +class PartnerBillingEntity(TypedDict, total=False): + """Partner Billing details associated with the resource. + + :ivar id: The Elastic Organization Id. + :vartype id: str + :ivar name: The Elastic Organization Name. + :vartype name: str + :ivar partner_entity_uri: Link to the elastic organization page. + :vartype partner_entity_uri: str + """ + + id: str + """The Elastic Organization Id.""" + name: str + """The Elastic Organization Name.""" + partnerEntityUri: str + """Link to the elastic organization page.""" + + +class PlanDetails(TypedDict, total=False): + """Plan details of the monitor resource. + + :ivar offer_id: Offer ID of the plan. + :vartype offer_id: str + :ivar publisher_id: Publisher ID of the plan. + :vartype publisher_id: str + :ivar term_id: Term ID of the plan. + :vartype term_id: str + :ivar plan_id: Plan ID. + :vartype plan_id: str + :ivar plan_name: Plan Name. + :vartype plan_name: str + """ + + offerID: str + """Offer ID of the plan.""" + publisherID: str + """Publisher ID of the plan.""" + termID: str + """Term ID of the plan.""" + planID: str + """Plan ID.""" + planName: str + """Plan Name.""" + + +class ProjectDetails(TypedDict, total=False): + """Project details of the monitor resource IF it belongs to Serverless offer kind. + + :ivar project_type: Project type; ex: Elasticsearch / Observability / Security. Known values + are: "Elasticsearch", "Observability", "Security", and "NotApplicable". + :vartype project_type: Union[str, "ProjectType"] + :ivar configuration_type: Configuration type of the Elasticsearch project. Known values are: + "GeneralPurpose", "Vector", "TimeSeries", and "NotApplicable". + :vartype configuration_type: Union[str, "ConfigurationType"] + """ + + projectType: Union[str, "ProjectType"] + """Project type; ex: Elasticsearch / Observability / Security. Known values are: + \"Elasticsearch\", \"Observability\", \"Security\", and \"NotApplicable\".""" + configurationType: Union[str, "ConfigurationType"] + """Configuration type of the Elasticsearch project. Known values are: \"GeneralPurpose\", + \"Vector\", \"TimeSeries\", and \"NotApplicable\".""" + + +class ResourceProviderDefaultErrorResponse(TypedDict, total=False): + """RP default error response. + + :ivar error: Response body of Error. + :vartype error: "ErrorResponseBody" + """ + + error: "ErrorResponseBody" + """Response body of Error.""" + + +class ResourceSku(TypedDict, total=False): + """Represents the SKU of a resource. + + :ivar name: The name of the SKU. Required. + :vartype name: str + """ + + name: Required[str] + """The name of the SKU. Required.""" + + +class ResubscribeProperties(TypedDict, total=False): + """Resubscribe Properties. + + :ivar plan_id: Newly selected plan Id to create the new Marketplace subscription for + Resubscribe. + :vartype plan_id: str + :ivar term: Newly selected term to create the new Marketplace subscription for Resubscribe. + :vartype term: str + :ivar subscription_id: Newly selected Azure Subscription Id in which the new Marketplace + subscription will be created for Resubscribe. + :vartype subscription_id: str + :ivar resource_group: Newly selected Azure resource group in which the new Marketplace + subscription will be created for Resubscribe. + :vartype resource_group: str + :ivar organization_id: Organization Id of the Elastic Organization that needs to be + resubscribed. + :vartype organization_id: str + """ + + planId: str + """Newly selected plan Id to create the new Marketplace subscription for Resubscribe.""" + term: str + """Newly selected term to create the new Marketplace subscription for Resubscribe.""" + subscriptionId: str + """Newly selected Azure Subscription Id in which the new Marketplace subscription will be created + for Resubscribe.""" + resourceGroup: str + """Newly selected Azure resource group in which the new Marketplace subscription will be created + for Resubscribe.""" + organizationId: str + """Organization Id of the Elastic Organization that needs to be resubscribed.""" + + +class SubscriptionList(TypedDict, total=False): + """The request to update subscriptions needed to be monitored by the Elastic monitor resource. + + :ivar operation: The operation for the patch on the resource. Known values are: "AddBegin", + "AddComplete", "DeleteBegin", "DeleteComplete", and "Active". + :vartype operation: Union[str, "Operation"] + :ivar monitored_subscription_list: List of subscriptions and the state of the monitoring. + :vartype monitored_subscription_list: list["MonitoredSubscription"] + :ivar provisioning_state: Provisioning State of the resource. Known values are: "Accepted", + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and + "NotSpecified". + :vartype provisioning_state: Union[str, "ProvisioningState"] + """ + + operation: Union[str, "Operation"] + """The operation for the patch on the resource. Known values are: \"AddBegin\", \"AddComplete\", + \"DeleteBegin\", \"DeleteComplete\", and \"Active\".""" + monitoredSubscriptionList: list["MonitoredSubscription"] + """List of subscriptions and the state of the monitoring.""" + provisioningState: Union[str, "ProvisioningState"] + """Provisioning State of the resource. Known values are: \"Accepted\", \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + + +class SystemData(TypedDict, total=False): + """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: Union[str, "CreatedByType"] + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: str + :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: Union[str, "CreatedByType"] + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: str + """ + + createdBy: str + """The identity that created the resource.""" + createdByType: Union[str, "CreatedByType"] + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + createdAt: str + """The timestamp of resource creation (UTC).""" + lastModifiedBy: str + """The identity that last modified the resource.""" + lastModifiedByType: Union[str, "CreatedByType"] + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + lastModifiedAt: str + """The timestamp of resource last modification (UTC).""" + + +class UpgradableVersionsList(TypedDict, total=False): + """Stack Versions that this version can upgrade to. + + :ivar current_version: Current version of the elastic monitor. + :vartype current_version: str + :ivar upgradable_versions: Stack Versions that this version can upgrade to. + :vartype upgradable_versions: list[str] + """ + + currentVersion: str + """Current version of the elastic monitor.""" + upgradableVersions: list[str] + """Stack Versions that this version can upgrade to.""" + + +class UserApiKeyResponse(TypedDict, total=False): + """The User Api Key created for the Organization associated with the User Email Id that was passed + in the request. + + :ivar properties: + :vartype properties: "UserApiKeyResponseProperties" + """ + + properties: "UserApiKeyResponseProperties" + + +class UserApiKeyResponseProperties(TypedDict, total=False): + """UserApiKeyResponseProperties. + + :ivar api_key: The User Api Key Generated based on GenerateApiKey flag. This is applicable for + non-Portal clients only. + :vartype api_key: str + """ + + apiKey: str + """The User Api Key Generated based on GenerateApiKey flag. This is applicable for non-Portal + clients only.""" + + +class UserEmailId(TypedDict, total=False): + """Email Id of the User Organization, of which the API Key must be returned. + + :ivar email_id: The User email Id. + :vartype email_id: str + """ + + emailId: str + """The User email Id.""" + + +class UserInfo(TypedDict, total=False): + """User Information to be passed to partners. + + :ivar first_name: First name of the user. + :vartype first_name: str + :ivar last_name: Last name of the user. + :vartype last_name: str + :ivar company_name: Company name of the user. + :vartype company_name: str + :ivar email_address: Email of the user used by Elastic for contacting them if needed. + :vartype email_address: str + :ivar company_info: Company information of the user to be passed to partners. + :vartype company_info: "CompanyInfo" + """ + + firstName: str + """First name of the user.""" + lastName: str + """Last name of the user.""" + companyName: str + """Company name of the user.""" + emailAddress: str + """Email of the user used by Elastic for contacting them if needed.""" + companyInfo: "CompanyInfo" + """Company information of the user to be passed to partners.""" + + +class VMCollectionUpdate(TypedDict, total=False): + """Update VM resource collection. + + :ivar vm_resource_id: ARM id of the VM resource. + :vartype vm_resource_id: str + :ivar operation_name: Operation to be performed for given VM. Known values are: "Add" and + "Delete". + :vartype operation_name: Union[str, "OperationName"] + """ + + vmResourceId: str + """ARM id of the VM resource.""" + operationName: Union[str, "OperationName"] + """Operation to be performed for given VM. Known values are: \"Add\" and \"Delete\".""" + + +class VMIngestionDetailsResponse(TypedDict, total=False): + """The vm ingestion details to install an agent. + + :ivar cloud_id: The cloudId of given Elastic monitor resource. + :vartype cloud_id: str + :ivar ingestion_key: Ingestion details to install agent on given VM. + :vartype ingestion_key: str + """ + + cloudId: str + """The cloudId of given Elastic monitor resource.""" + ingestionKey: str + """Ingestion details to install agent on given VM.""" + + +class VMResources(TypedDict, total=False): + """The vm resource properties that is currently being monitored by the Elastic monitor resource. + + :ivar vm_resource_id: The ARM id of the VM resource. + :vartype vm_resource_id: str + """ + + vmResourceId: str + """The ARM id of the VM resource.""" diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py index dcfd5d6caa80..118cfba78932 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.all_traffic_filters.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AllTrafficFilters_list.json +# x-ms-original-file: 2025-06-01/AllTrafficFilters_list.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py index aff5daae7bf9..6584c00e3205 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.associate_traffic_filter.begin_associate( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociateTrafficFilter_Update.json +# x-ms-original-file: 2025-06-01/AssociateTrafficFilter_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py index 242840ac1f17..be7ce211dd82 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.list_associated_traffic_filters.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociatedFiltersForDeployment_list.json +# x-ms-original-file: 2025-06-01/AssociatedFiltersForDeployment_list.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/billing_info_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/billing_info_get.py index 0bfa642581b3..f979dabddf96 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/billing_info_get.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/billing_info_get.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.billing_info.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/BillingInfo_Get.json +# x-ms-original-file: 2025-06-01/BillingInfo_Get.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/connected_partner_resources_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/connected_partner_resources_list.py index 7d8ff1618a36..8cfdd0423511 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/connected_partner_resources_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/connected_partner_resources_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.connected_partner_resources.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ConnectedPartnerResources_List.json +# x-ms-original-file: 2025-06-01/ConnectedPartnerResources_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py index 2eade0679051..e5bf1d681d19 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.deployment_info.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DeploymentInfo_List.json +# x-ms-original-file: 2025-06-01/DeploymentInfo_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py index 6d2bca02e56c..4fc7a8eda164 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.detach_and_delete_traffic_filter.delete( @@ -37,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachAndDeleteTrafficFilter_Delete.json +# x-ms-original-file: 2025-06-01/DetachAndDeleteTrafficFilter_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py index 18f156a6d8db..798d0130d893 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.detach_traffic_filter.begin_update( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachTrafficFilters_Update.json +# x-ms-original-file: 2025-06-01/DetachTrafficFilters_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/elastic_versions_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/elastic_versions_list.py index 1ed8a0de3f43..1dbbcd83dfa9 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/elastic_versions_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/elastic_versions_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.elastic_versions.list( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ElasticVersions_List.json +# x-ms-original-file: 2025-06-01/ElasticVersions_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py index f88a6c7ee366..4d7b766d485e 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.external_user.create_or_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ExternalUserInfo.json +# x-ms-original-file: 2025-06-01/ExternalUserInfo.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py index dafde094b78c..327f42866802 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.create_and_associate_ip_filter.begin_create( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/IPTrafficFilter_Create.json +# x-ms-original-file: 2025-06-01/IPTrafficFilter_Create.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py index c345d1cc1582..f5ebe2b9c28f 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.monitor.begin_upgrade( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitor_Upgrade.json +# x-ms-original-file: 2025-06-01/Monitor_Upgrade.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py index 64c55597c416..0b13a9a038b1 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitored_resources.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredResources_List.json +# x-ms-original-file: 2025-06-01/MonitoredResources_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_createor_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_createor_update.py index 50a1bbad9c76..58e32cf46f51 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_createor_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_createor_update.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitored_subscriptions.begin_createor_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_CreateorUpdate.json +# x-ms-original-file: 2025-06-01/MonitoredSubscriptions_CreateorUpdate.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_delete.py index 235d5db8afbb..0c5e4192b7fa 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_delete.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.monitored_subscriptions.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Delete.json +# x-ms-original-file: 2025-06-01/MonitoredSubscriptions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_get.py index 1293ed96e24c..73987a98c58d 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_get.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_get.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitored_subscriptions.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Get.json +# x-ms-original-file: 2025-06-01/MonitoredSubscriptions_Get.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_list.py index 61ff81568f23..08691ad3bcc4 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitored_subscriptions.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_List.json +# x-ms-original-file: 2025-06-01/MonitoredSubscriptions_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_update.py index a0ee835124ce..56e9824f98e4 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_subscriptions_update.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitored_subscriptions.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Update.json +# x-ms-original-file: 2025-06-01/MonitoredSubscriptions_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py index 4e7538dcc093..40a3c7d6d332 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitors.begin_create( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Create.json +# x-ms-original-file: 2025-06-01/Monitors_Create.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py index 92b27067d1e7..594c92c41e8a 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.monitors.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Delete.json +# x-ms-original-file: 2025-06-01/Monitors_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py index dfb6e9d99a2e..0c597775c917 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitors.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Get.json +# x-ms-original-file: 2025-06-01/Monitors_Get.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py index b3431e94e5e2..814bb6d2d6dc 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitors.list() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_List.json +# x-ms-original-file: 2025-06-01/Monitors_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py index 9106309a16da..eae6bced5f01 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitors.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_ListByResourceGroup.json +# x-ms-original-file: 2025-06-01/Monitors_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py index 5a3293a54f64..3e5db7058aac 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.monitors.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Update.json +# x-ms-original-file: 2025-06-01/Monitors_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_create_or_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_create_or_update.py index 5e6199f65d2e..f98b49cf8ade 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_create_or_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_create_or_update.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.open_ai.create_or_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_CreateOrUpdate.json +# x-ms-original-file: 2025-06-01/OpenAI_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_delete.py index 176082b5e009..fd028cb4d97c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_delete.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.open_ai.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Delete.json +# x-ms-original-file: 2025-06-01/OpenAI_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get.py index fc8e2cc304e6..f1175257547f 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.open_ai.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Get.json +# x-ms-original-file: 2025-06-01/OpenAI_Get.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get_status.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get_status.py index 628cb7f72a6d..02fe226cd6b9 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get_status.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get_status.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.open_ai.get_status( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_GetStatus.json +# x-ms-original-file: 2025-06-01/OpenAI_GetStatus.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_list.py index 42ffdbaf87c3..47d7c739ab66 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.open_ai.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_List.json +# x-ms-original-file: 2025-06-01/OpenAI_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py index 5ca52534c5ed..82e671d941a2 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,7 +25,7 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Operations_List.json +# x-ms-original-file: 2025-06-01/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py index ab88ee273ff1..f0f77e0d08dd 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,15 +25,15 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.organizations.get_api_key() print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetApiKey.json +# x-ms-original-file: 2025-06-01/Organizations_GetApiKey.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_elastic_to_azure_subscription_mapping.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_elastic_to_azure_subscription_mapping.py index 6a6099cc9407..711c179dae72 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_elastic_to_azure_subscription_mapping.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_elastic_to_azure_subscription_mapping.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,15 +25,15 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.organizations.get_elastic_to_azure_subscription_mapping() print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetElasticToAzureSubscriptionMapping.json +# x-ms-original-file: 2025-06-01/Organizations_GetElasticToAzureSubscriptionMapping.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_resubscribe.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_resubscribe.py index f97b456ec9d0..155950c71c92 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_resubscribe.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_resubscribe.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.organizations.begin_resubscribe( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_Resubscribe.json +# x-ms-original-file: 2025-06-01/Organizations_Resubscribe.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py index 027c702b7caf..b2b7e0e3612a 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.create_and_associate_pl_filter.begin_create( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/PrivateLinkTrafficFilters_Create.json +# x-ms-original-file: 2025-06-01/PrivateLinkTrafficFilters_Create.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py index c26365b8aaca..4178d67a564c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.tag_rules.create_or_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_CreateOrUpdate.json +# x-ms-original-file: 2025-06-01/TagRules_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py index e950d89788b2..bb6b6210c3ba 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.tag_rules.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Delete.json +# x-ms-original-file: 2025-06-01/TagRules_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py index 3d2b3796e20f..4e154c87b8d0 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.tag_rules.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Get.json +# x-ms-original-file: 2025-06-01/TagRules_Get.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py index ae38f3519d55..46925e39957a 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.tag_rules.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_List.json +# x-ms-original-file: 2025-06-01/TagRules_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py index cf49bb34029f..0f478d6fc388 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.traffic_filters.delete( @@ -37,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TrafficFilters_Delete.json +# x-ms-original-file: 2025-06-01/TrafficFilters_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py index c20f3ab2c4b5..4976a9641902 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.upgradable_versions.details( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/UpgradableVersions_Details.json +# x-ms-original-file: 2025-06-01/UpgradableVersions_Details.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py index d9665544d453..0047df42feb7 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.vm_collection.update( @@ -37,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMCollection_Update.json +# x-ms-original-file: 2025-06-01/VMCollection_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py index a67ddea2883c..65e6ff210b04 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vm_host.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMHost_List.json +# x-ms-original-file: 2025-06-01/VMHost_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py index e1e989af9109..72ca0eb1ff90 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py @@ -1,15 +1,14 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftElastic( + client = ElasticMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vm_ingestion.details( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMIngestion_Details.json +# x-ms-original-file: 2025-06-01/VMIngestion_Details.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/conftest.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/conftest.py index 399f5d489989..d4e7f4294962 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/conftest.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import os @@ -21,14 +21,14 @@ # For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - microsoftelastic_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - microsoftelastic_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - microsoftelastic_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - microsoftelastic_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=microsoftelastic_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=microsoftelastic_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=microsoftelastic_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=microsoftelastic_client_secret, value="00000000-0000-0000-0000-000000000000") + elasticmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + elasticmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + elasticmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + elasticmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=elasticmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=elasticmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=elasticmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=elasticmgmt_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;") diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_all_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_all_traffic_filters_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_all_traffic_filters_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_all_traffic_filters_operations.py index fc1f5635a125..150cf940d7b5 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_all_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_all_traffic_filters_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticAllTrafficFiltersOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtAllTrafficFiltersOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_all_traffic_filters_list(self, resource_group): response = self.client.all_traffic_filters.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_all_traffic_filters_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_all_traffic_filters_operations_async.py similarity index 77% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_all_traffic_filters_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_all_traffic_filters_operations_async.py index d9c5cf9aa635..a67b0010561c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_all_traffic_filters_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_all_traffic_filters_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticAllTrafficFiltersOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtAllTrafficFiltersOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_all_traffic_filters_list(self, resource_group): response = await self.client.all_traffic_filters.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_associate_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_associate_traffic_filter_operations.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_associate_traffic_filter_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_associate_traffic_filter_operations.py index f6d68cae1ecb..ddd642b8289e 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_associate_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_associate_traffic_filter_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticAssociateTrafficFilterOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtAssociateTrafficFilterOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_associate_traffic_filter_begin_associate(self, resource_group): response = self.client.associate_traffic_filter.begin_associate( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_associate_traffic_filter_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_associate_traffic_filter_operations_async.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_associate_traffic_filter_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_associate_traffic_filter_operations_async.py index 9f409da6faf3..9b9bf66bafa4 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_associate_traffic_filter_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_associate_traffic_filter_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticAssociateTrafficFilterOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtAssociateTrafficFilterOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -26,7 +26,6 @@ async def test_associate_traffic_filter_begin_associate(self, resource_group): await self.client.associate_traffic_filter.begin_associate( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_billing_info_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_billing_info_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_billing_info_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_billing_info_operations.py index 20c3001c20f0..fac47b54982a 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_billing_info_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_billing_info_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticBillingInfoOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtBillingInfoOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_billing_info_get(self, resource_group): response = self.client.billing_info.get( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_billing_info_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_billing_info_operations_async.py similarity index 77% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_billing_info_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_billing_info_operations_async.py index 89175e5f1f9f..dd95b36965f6 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_billing_info_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_billing_info_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticBillingInfoOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtBillingInfoOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_billing_info_get(self, resource_group): response = await self.client.billing_info.get( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_connected_partner_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_connected_partner_resources_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_connected_partner_resources_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_connected_partner_resources_operations.py index a61978b05b02..ae93f800ae78 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_connected_partner_resources_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_connected_partner_resources_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticConnectedPartnerResourcesOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtConnectedPartnerResourcesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_connected_partner_resources_list(self, resource_group): response = self.client.connected_partner_resources.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_connected_partner_resources_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_connected_partner_resources_operations_async.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_connected_partner_resources_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_connected_partner_resources_operations_async.py index 2ff0f5acce64..e8ea57cc3e0d 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_connected_partner_resources_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_connected_partner_resources_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticConnectedPartnerResourcesOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtConnectedPartnerResourcesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_connected_partner_resources_list(self, resource_group): response = self.client.connected_partner_resources.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_deployment_info_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_deployment_info_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_deployment_info_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_deployment_info_operations.py index a83686477fbd..e2ae4e5edf1c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_deployment_info_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_deployment_info_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticDeploymentInfoOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtDeploymentInfoOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_deployment_info_list(self, resource_group): response = self.client.deployment_info.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_deployment_info_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_deployment_info_operations_async.py similarity index 77% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_deployment_info_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_deployment_info_operations_async.py index 8665c880a987..09bb3b4f0bdf 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_deployment_info_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_deployment_info_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticDeploymentInfoOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtDeploymentInfoOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_deployment_info_list(self, resource_group): response = await self.client.deployment_info.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_and_delete_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_and_delete_traffic_filter_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_and_delete_traffic_filter_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_and_delete_traffic_filter_operations.py index 56176edd7fd3..cf2f86c7260f 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_and_delete_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_and_delete_traffic_filter_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticDetachAndDeleteTrafficFilterOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtDetachAndDeleteTrafficFilterOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_detach_and_delete_traffic_filter_delete(self, resource_group): response = self.client.detach_and_delete_traffic_filter.delete( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_and_delete_traffic_filter_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_and_delete_traffic_filter_operations_async.py similarity index 77% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_and_delete_traffic_filter_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_and_delete_traffic_filter_operations_async.py index 9f7d47132488..2221e23726d4 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_and_delete_traffic_filter_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_and_delete_traffic_filter_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticDetachAndDeleteTrafficFilterOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtDetachAndDeleteTrafficFilterOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_detach_and_delete_traffic_filter_delete(self, resource_group): response = await self.client.detach_and_delete_traffic_filter.delete( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_traffic_filter_operations.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_traffic_filter_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_traffic_filter_operations.py index fc850d63a1ee..068a8495e4a2 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_traffic_filter_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticDetachTrafficFilterOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtDetachTrafficFilterOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_detach_traffic_filter_begin_update(self, resource_group): response = self.client.detach_traffic_filter.begin_update( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_traffic_filter_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_traffic_filter_operations_async.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_traffic_filter_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_traffic_filter_operations_async.py index 7c8c94576c53..767801f98098 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_detach_traffic_filter_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_detach_traffic_filter_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticDetachTrafficFilterOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtDetachTrafficFilterOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -26,7 +26,6 @@ async def test_detach_traffic_filter_begin_update(self, resource_group): await self.client.detach_traffic_filter.begin_update( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_elastic_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_elastic_versions_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_elastic_versions_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_elastic_versions_operations.py index 71320fc41565..9649772e9c7e 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_elastic_versions_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_elastic_versions_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,16 +14,15 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticElasticVersionsOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtElasticVersionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_elastic_versions_list(self, resource_group): response = self.client.elastic_versions.list( region="str", - api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_elastic_versions_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_elastic_versions_operations_async.py similarity index 77% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_elastic_versions_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_elastic_versions_operations_async.py index a4ca6c268147..5f76aa06778e 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_elastic_versions_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_elastic_versions_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,16 +15,15 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticElasticVersionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtElasticVersionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_elastic_versions_list(self, resource_group): response = self.client.elastic_versions.list( region="str", - api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_external_user_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_external_user_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_external_user_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_external_user_operations.py index 5deb968ddcfb..1ac199619d30 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_external_user_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_external_user_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticExternalUserOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtExternalUserOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_external_user_create_or_update(self, resource_group): response = self.client.external_user.create_or_update( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_external_user_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_external_user_operations_async.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_external_user_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_external_user_operations_async.py index b0a541afcfd6..48c4af1a09dd 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_external_user_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_external_user_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticExternalUserOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtExternalUserOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_external_user_create_or_update(self, resource_group): response = await self.client.external_user.create_or_update( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitor_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitor_operations.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitor_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitor_operations.py index 95b499d8fe75..d9642fe0155f 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitor_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitor_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticMonitorOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtMonitorOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_monitor_begin_upgrade(self, resource_group): response = self.client.monitor.begin_upgrade( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitor_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitor_operations_async.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitor_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitor_operations_async.py index 57a6f2b5d1b0..c368df7f7393 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitor_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitor_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticMonitorOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtMonitorOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -26,7 +26,6 @@ async def test_monitor_begin_upgrade(self, resource_group): await self.client.monitor.begin_upgrade( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_resources_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_resources_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_resources_operations.py index 43a08248e2a3..314afba29476 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_resources_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_resources_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticMonitoredResourcesOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtMonitoredResourcesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_monitored_resources_list(self, resource_group): response = self.client.monitored_resources.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_resources_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_resources_operations_async.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_resources_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_resources_operations_async.py index 7277a46eb696..0d9f328435c8 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_resources_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_resources_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticMonitoredResourcesOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtMonitoredResourcesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_monitored_resources_list(self, resource_group): response = self.client.monitored_resources.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_subscriptions_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_subscriptions_operations.py similarity index 87% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_subscriptions_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_subscriptions_operations.py index 33db655a1569..d59638d3adee 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_subscriptions_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_subscriptions_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticMonitoredSubscriptionsOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtMonitoredSubscriptionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_monitored_subscriptions_list(self, resource_group): - response = self.client.monitored_subscriptions.list( - resource_group_name=resource_group.name, - monitor_name="str", - api_version="2025-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_monitored_subscriptions_get(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", configuration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -50,7 +37,6 @@ def test_monitored_subscriptions_begin_createor_update(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", configuration_name="str", - api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -63,7 +49,6 @@ def test_monitored_subscriptions_begin_update(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", configuration_name="str", - api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -76,8 +61,18 @@ def test_monitored_subscriptions_begin_delete(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", configuration_name="str", - api_version="2025-06-01", ).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_monitored_subscriptions_list(self, resource_group): + response = self.client.monitored_subscriptions.list( + resource_group_name=resource_group.name, + monitor_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_subscriptions_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_subscriptions_operations_async.py similarity index 87% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_subscriptions_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_subscriptions_operations_async.py index 9fb1078b36cd..7841ba412213 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitored_subscriptions_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitored_subscriptions_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticMonitoredSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtMonitoredSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_monitored_subscriptions_list(self, resource_group): - response = self.client.monitored_subscriptions.list( - resource_group_name=resource_group.name, - monitor_name="str", - api_version="2025-06-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_monitored_subscriptions_get(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", configuration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -52,7 +39,6 @@ async def test_monitored_subscriptions_begin_createor_update(self, resource_grou resource_group_name=resource_group.name, monitor_name="str", configuration_name="str", - api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -67,7 +53,6 @@ async def test_monitored_subscriptions_begin_update(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", configuration_name="str", - api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -82,9 +67,19 @@ async def test_monitored_subscriptions_begin_delete(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", configuration_name="str", - api_version="2025-06-01", ) ).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_monitored_subscriptions_list(self, resource_group): + response = self.client.monitored_subscriptions.list( + resource_group_name=resource_group.name, + monitor_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitors_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitors_operations.py similarity index 84% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitors_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitors_operations.py index 5721e0279c61..469990ff21bb 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitors_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitors_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,30 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticMonitorsOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtMonitorsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_monitors_list(self, resource_group): - response = self.client.monitors.list( - api_version="2025-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_monitors_list_by_resource_group(self, resource_group): - response = self.client.monitors.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -45,7 +24,6 @@ def test_monitors_get(self, resource_group): response = self.client.monitors.get( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -57,7 +35,6 @@ def test_monitors_begin_create(self, resource_group): response = self.client.monitors.begin_create( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -69,7 +46,6 @@ def test_monitors_begin_update(self, resource_group): response = self.client.monitors.begin_update( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -81,8 +57,25 @@ def test_monitors_begin_delete(self, resource_group): response = self.client.monitors.begin_delete( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ).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_monitors_list_by_resource_group(self, resource_group): + response = self.client.monitors.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_monitors_list(self, resource_group): + response = self.client.monitors.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitors_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitors_operations_async.py similarity index 85% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitors_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitors_operations_async.py index 7797eb923cbc..8b763bc0581b 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_monitors_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_monitors_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,30 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticMonitorsOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtMonitorsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_monitors_list(self, resource_group): - response = self.client.monitors.list( - api_version="2025-06-01", - ) - 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_monitors_list_by_resource_group(self, resource_group): - response = self.client.monitors.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-06-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -46,7 +25,6 @@ async def test_monitors_get(self, resource_group): response = await self.client.monitors.get( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -59,7 +37,6 @@ async def test_monitors_begin_create(self, resource_group): await self.client.monitors.begin_create( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -73,7 +50,6 @@ async def test_monitors_begin_update(self, resource_group): await self.client.monitors.begin_update( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -87,9 +63,26 @@ async def test_monitors_begin_delete(self, resource_group): await self.client.monitors.begin_delete( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) ).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_monitors_list_by_resource_group(self, resource_group): + response = self.client.monitors.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_monitors_list(self, resource_group): + response = self.client.monitors.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_open_ai_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_open_ai_operations.py similarity index 85% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_open_ai_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_open_ai_operations.py index bce7b9920cd2..a9c102723e13 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_open_ai_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_open_ai_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticOpenAIOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtOpenAIOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_open_ai_list(self, resource_group): - response = self.client.open_ai.list( - resource_group_name=resource_group.name, - monitor_name="str", - api_version="2025-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_open_ai_get(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", integration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -50,7 +37,6 @@ def test_open_ai_create_or_update(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", integration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -63,12 +49,22 @@ def test_open_ai_delete(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", integration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_open_ai_list(self, resource_group): + response = self.client.open_ai.list( + resource_group_name=resource_group.name, + monitor_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_open_ai_get_status(self, resource_group): @@ -76,7 +72,6 @@ def test_open_ai_get_status(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", integration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_open_ai_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_open_ai_operations_async.py similarity index 85% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_open_ai_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_open_ai_operations_async.py index 55c17ff8f3ed..ce4ed6048ae1 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_open_ai_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_open_ai_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticOpenAIOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtOpenAIOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_open_ai_list(self, resource_group): - response = self.client.open_ai.list( - resource_group_name=resource_group.name, - monitor_name="str", - api_version="2025-06-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_open_ai_get(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", integration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -51,7 +38,6 @@ async def test_open_ai_create_or_update(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", integration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -64,12 +50,22 @@ async def test_open_ai_delete(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", integration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_open_ai_list(self, resource_group): + response = self.client.open_ai.list( + resource_group_name=resource_group.name, + monitor_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_open_ai_get_status(self, resource_group): @@ -77,7 +73,6 @@ async def test_open_ai_get_status(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", integration_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_operations.py similarity index 73% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_operations.py index 1c7ee8080335..8e959dd778e6 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,16 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-06-01", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_operations_async.py similarity index 73% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_operations_async.py index 9d407c473651..47c5171b5df7 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,16 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-06-01", - ) + response = self.client.operations.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_organizations_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_organizations_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_organizations_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_organizations_operations.py index aa02f048e9a1..7b62a5fc27da 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_organizations_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_organizations_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,38 +14,33 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticOrganizationsOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtOrganizationsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_organizations_get_api_key(self, resource_group): - response = self.client.organizations.get_api_key( - api_version="2025-06-01", - ) + def test_organizations_begin_resubscribe(self, resource_group): + response = self.client.organizations.begin_resubscribe( + resource_group_name=resource_group.name, + monitor_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_organizations_get_elastic_to_azure_subscription_mapping(self, resource_group): - response = self.client.organizations.get_elastic_to_azure_subscription_mapping( - api_version="2025-06-01", - ) + def test_organizations_get_api_key(self, resource_group): + response = self.client.organizations.get_api_key() # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_organizations_begin_resubscribe(self, resource_group): - response = self.client.organizations.begin_resubscribe( - resource_group_name=resource_group.name, - monitor_name="str", - api_version="2025-06-01", - ).result() # call '.result()' to poll until service return final result + def test_organizations_get_elastic_to_azure_subscription_mapping(self, resource_group): + response = self.client.organizations.get_elastic_to_azure_subscription_mapping() # please add some check logic here by yourself # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_organizations_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_organizations_operations_async.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_organizations_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_organizations_operations_async.py index caaddef5ec4a..327cb99408a0 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_organizations_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_organizations_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,40 +15,35 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticOrganizationsOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtOrganizationsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_organizations_get_api_key(self, resource_group): - response = await self.client.organizations.get_api_key( - api_version="2025-06-01", - ) + async def test_organizations_begin_resubscribe(self, resource_group): + response = await ( + await self.client.organizations.begin_resubscribe( + resource_group_name=resource_group.name, + monitor_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_organizations_get_elastic_to_azure_subscription_mapping(self, resource_group): - response = await self.client.organizations.get_elastic_to_azure_subscription_mapping( - api_version="2025-06-01", - ) + async def test_organizations_get_api_key(self, resource_group): + response = await self.client.organizations.get_api_key() # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_organizations_begin_resubscribe(self, resource_group): - response = await ( - await self.client.organizations.begin_resubscribe( - resource_group_name=resource_group.name, - monitor_name="str", - api_version="2025-06-01", - ) - ).result() # call '.result()' to poll until service return final result + async def test_organizations_get_elastic_to_azure_subscription_mapping(self, resource_group): + response = await self.client.organizations.get_elastic_to_azure_subscription_mapping() # please add some check logic here by yourself # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_tag_rules_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_tag_rules_operations.py similarity index 85% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_tag_rules_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_tag_rules_operations.py index dab2f7d67309..b618a5564d80 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_tag_rules_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_tag_rules_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,19 +14,19 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticTagRulesOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtTagRulesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_tag_rules_list(self, resource_group): - response = self.client.tag_rules.list( + def test_tag_rules_get(self, resource_group): + response = self.client.tag_rules.get( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", + rule_set_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @@ -37,7 +37,6 @@ def test_tag_rules_create_or_update(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", rule_set_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -45,26 +44,23 @@ def test_tag_rules_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_tag_rules_get(self, resource_group): - response = self.client.tag_rules.get( + def test_tag_rules_begin_delete(self, resource_group): + response = self.client.tag_rules.begin_delete( resource_group_name=resource_group.name, monitor_name="str", rule_set_name="str", - api_version="2025-06-01", - ) + ).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_tag_rules_begin_delete(self, resource_group): - response = self.client.tag_rules.begin_delete( + def test_tag_rules_list(self, resource_group): + response = self.client.tag_rules.list( resource_group_name=resource_group.name, monitor_name="str", - rule_set_name="str", - api_version="2025-06-01", - ).result() # call '.result()' to poll until service return final result - + ) + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_tag_rules_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_tag_rules_operations_async.py similarity index 85% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_tag_rules_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_tag_rules_operations_async.py index 4e9afbad8e78..7c8ff4411038 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_tag_rules_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_tag_rules_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,30 +15,17 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticTagRulesOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtTagRulesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_tag_rules_list(self, resource_group): - response = self.client.tag_rules.list( - resource_group_name=resource_group.name, - monitor_name="str", - api_version="2025-06-01", - ) - 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_tag_rules_create_or_update(self, resource_group): - response = await self.client.tag_rules.create_or_update( + async def test_tag_rules_get(self, resource_group): + response = await self.client.tag_rules.get( resource_group_name=resource_group.name, monitor_name="str", rule_set_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -46,12 +33,11 @@ async def test_tag_rules_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_tag_rules_get(self, resource_group): - response = await self.client.tag_rules.get( + async def test_tag_rules_create_or_update(self, resource_group): + response = await self.client.tag_rules.create_or_update( resource_group_name=resource_group.name, monitor_name="str", rule_set_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself @@ -65,9 +51,19 @@ async def test_tag_rules_begin_delete(self, resource_group): resource_group_name=resource_group.name, monitor_name="str", rule_set_name="str", - api_version="2025-06-01", ) ).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_tag_rules_list(self, resource_group): + response = self.client.tag_rules.list( + resource_group_name=resource_group.name, + monitor_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_traffic_filters_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_traffic_filters_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_traffic_filters_operations.py index 5d9c25c3cf4d..df2abb3dd36d 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_traffic_filters_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticTrafficFiltersOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtTrafficFiltersOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_traffic_filters_delete(self, resource_group): response = self.client.traffic_filters.delete( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_traffic_filters_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_traffic_filters_operations_async.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_traffic_filters_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_traffic_filters_operations_async.py index 240bad706372..3e3886e93a72 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_traffic_filters_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_traffic_filters_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticTrafficFiltersOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtTrafficFiltersOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_traffic_filters_delete(self, resource_group): response = await self.client.traffic_filters.delete( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_upgradable_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_upgradable_versions_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_upgradable_versions_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_upgradable_versions_operations.py index 7e3363a384b3..ce7920e8fce0 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_upgradable_versions_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_upgradable_versions_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticUpgradableVersionsOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtUpgradableVersionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_upgradable_versions_details(self, resource_group): response = self.client.upgradable_versions.details( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_upgradable_versions_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_upgradable_versions_operations_async.py similarity index 77% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_upgradable_versions_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_upgradable_versions_operations_async.py index 753c5ec3e499..ebf22a296e53 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_upgradable_versions_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_upgradable_versions_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticUpgradableVersionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtUpgradableVersionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_upgradable_versions_details(self, resource_group): response = await self.client.upgradable_versions.details( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_collection_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_collection_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_collection_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_collection_operations.py index e9641dfe81af..ec8fd92deb6e 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_collection_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_collection_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticVMCollectionOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtVMCollectionOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_vm_collection_update(self, resource_group): response = self.client.vm_collection.update( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_collection_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_collection_operations_async.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_collection_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_collection_operations_async.py index d71da7ebb485..890f7e196e5b 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_collection_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_collection_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticVMCollectionOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtVMCollectionOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_vm_collection_update(self, resource_group): response = await self.client.vm_collection.update( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_host_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_host_operations.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_host_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_host_operations.py index cf45106a1b5a..b1e3d6835a53 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_host_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_host_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticVMHostOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtVMHostOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_vm_host_list(self, resource_group): response = self.client.vm_host.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_host_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_host_operations_async.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_host_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_host_operations_async.py index 7a7060450f08..b3518c6c2491 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_host_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_host_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticVMHostOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtVMHostOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_vm_host_list(self, resource_group): response = self.client.vm_host.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_ingestion_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_ingestion_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_ingestion_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_ingestion_operations.py index 512216759d72..246a1df9c4a7 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_ingestion_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_ingestion_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticVMIngestionOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtVMIngestionOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_vm_ingestion_details(self, resource_group): response = self.client.vm_ingestion.details( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_ingestion_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_ingestion_operations_async.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_ingestion_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_ingestion_operations_async.py index 4dd96c538241..a8916903352a 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_vm_ingestion_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_vm_ingestion_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticVMIngestionOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtVMIngestionOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_vm_ingestion_details(self, resource_group): response = await self.client.vm_ingestion.details( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_ip_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_ip_filter_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations.py index ce14c83751c5..028dd305f6cc 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_ip_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticCreateAndAssociateIPFilterOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtcreateAndAssociateIPFilterOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_create_and_associate_ip_filter_begin_create(self, resource_group): response = self.client.create_and_associate_ip_filter.begin_create( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_ip_filter_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations_async.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_ip_filter_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations_async.py index 210c7f90bf84..8471100e5172 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_ip_filter_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticCreateAndAssociateIPFilterOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtcreateAndAssociateIPFilterOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -26,7 +26,6 @@ async def test_create_and_associate_ip_filter_begin_create(self, resource_group) await self.client.create_and_associate_ip_filter.begin_create( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_pl_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_pl_filter_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations.py index 1bfcfe4e2e36..d31b7dac85cc 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_pl_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticCreateAndAssociatePLFilterOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtcreateAndAssociatePLFilterOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_create_and_associate_pl_filter_begin_create(self, resource_group): response = self.client.create_and_associate_pl_filter.begin_create( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_pl_filter_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations_async.py similarity index 79% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_pl_filter_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations_async.py index f5b1a2a6bd92..7fd76efb7478 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_create_and_associate_pl_filter_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticCreateAndAssociatePLFilterOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtcreateAndAssociatePLFilterOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -26,7 +26,6 @@ async def test_create_and_associate_pl_filter_begin_create(self, resource_group) await self.client.create_and_associate_pl_filter.begin_create( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_list_associated_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations.py similarity index 78% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_list_associated_traffic_filters_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations.py index 3d445740b7a8..654fe862b625 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_list_associated_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticListAssociatedTrafficFiltersOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtlistAssociatedTrafficFiltersOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_list_associated_traffic_filters_list(self, resource_group): response = self.client.list_associated_traffic_filters.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_list_associated_traffic_filters_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations_async.py similarity index 77% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_list_associated_traffic_filters_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations_async.py index 086acd7cb3e7..a78f72cb63b4 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_microsoft_elastic_list_associated_traffic_filters_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft 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. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftElasticListAssociatedTrafficFiltersOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtlistAssociatedTrafficFiltersOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_list_associated_traffic_filters_list(self, resource_group): response = await self.client.list_associated_traffic_filters.list( resource_group_name=resource_group.name, monitor_name="str", - api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/elastic/azure-mgmt-elastic/pyproject.toml b/sdk/elastic/azure-mgmt-elastic/pyproject.toml index 105c322a61bb..da3277c3bc4c 100644 --- a/sdk/elastic/azure-mgmt-elastic/pyproject.toml +++ b/sdk/elastic/azure-mgmt-elastic/pyproject.toml @@ -13,23 +13,23 @@ authors = [ description = "Microsoft Azure Elastic Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = [ "azure", "azure sdk", ] dependencies = [ - "msrest>=0.7.1", + "isodate>=0.6.1", "azure-mgmt-core>=1.6.0", "typing-extensions>=4.6.0", ] @@ -79,10 +79,10 @@ package_name = "azure-mgmt-elastic" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Elastic Management" package_doc_id = "" -is_stable = true +is_stable = false is_arm = true need_msrestazure = false need_azuremgmtcore = true -title = "MicrosoftElastic" +title = "ElasticMgmtClient" sample_link = "" exclude_folders = "" diff --git a/sdk/elastic/azure-mgmt-elastic/tsp-location.yaml b/sdk/elastic/azure-mgmt-elastic/tsp-location.yaml new file mode 100644 index 000000000000..55b41c1a7e32 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/elastic/Elastic.Management +commit: 3d1de464b5576fa149aed429795f6030313e31bb +repo: Azure/azure-rest-api-specs +additionalDirectories: From b61e159cbc59beceb8c09348be8d92afabffcfd5 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Mon, 6 Jul 2026 16:31:17 +0800 Subject: [PATCH 2/5] Optimize changelog for azure-mgmt-elastic --- sdk/elastic/azure-mgmt-elastic/CHANGELOG.md | 24 +++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md b/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md index bc35d15a476a..555677739106 100644 --- a/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md +++ b/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md @@ -9,30 +9,22 @@ - Added model `ProxyResource` - Added model `Resource` - Added model `TrackedResource` - - Added model `createAndAssociateIPFilterOperations` - - Added model `createAndAssociatePLFilterOperations` - - Added model `listAssociatedTrafficFiltersOperations` ### Breaking Changes - - Deleted or renamed model `MicrosoftElastic` - - Deleted or renamed model `ConnectedPartnerResourcesListResponse` - - Deleted or renamed model `ElasticMonitorResourceListResponse` - - Deleted or renamed model `ElasticVersionsListResponse` - - Deleted or renamed model `MonitoredResourceListResponse` - - Deleted or renamed model `MonitoredSubscriptionPropertiesList` - - Deleted or renamed model `MonitoringTagRulesListResponse` - - Deleted or renamed model `OpenAIIntegrationRPModelListResponse` - - Deleted or renamed model `OperationListResult` - - Deleted or renamed model `VMHostListResponse` + - Renamed client `MicrosoftElastic` to `ElasticMgmtClient` - Method `AssociateTrafficFilterOperations.begin_associate` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - Method `DetachAndDeleteTrafficFilterOperations.delete` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - Method `DetachTrafficFilterOperations.begin_update` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - Method `ElasticVersionsOperations.list` changed its parameter `region` from `positional_or_keyword` to `keyword_only` - Method `TrafficFiltersOperations.delete` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - - Deleted or renamed model `CreateAndAssociateIPFilterOperations` - - Deleted or renamed model `CreateAndAssociatePLFilterOperations` - - Deleted or renamed model `ListAssociatedTrafficFiltersOperations` + - Renamed operation group `CreateAndAssociateIPFilterOperations` to `createAndAssociateIPFilterOperations` + - Renamed operation group `CreateAndAssociatePLFilterOperations` to `createAndAssociatePLFilterOperations` + - Renamed operation group `ListAssociatedTrafficFiltersOperations` to `listAssociatedTrafficFiltersOperations` + +### Other Changes + + - Deleted model `ConnectedPartnerResourcesListResponse`/`ElasticMonitorResourceListResponse`/`ElasticVersionsListResponse`/`MonitoredResourceListResponse`/`MonitoredSubscriptionPropertiesList`/`MonitoringTagRulesListResponse`/`OpenAIIntegrationRPModelListResponse`/`OperationListResult`/`VMHostListResponse` which actually were not used by SDK users ## 2.0.0 (2025-11-17) From 92fb19b8ff8c026f6ee5a48871ed6d6ce404a849 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Mon, 6 Jul 2026 17:30:57 +0800 Subject: [PATCH 3/5] Fix test client name after TypeSpec migration (MicrosoftElastic -> ElasticMgmtClient) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../test_microsoft_elastic_monitors_operations_async_test.py | 4 ++-- .../tests/test_microsoft_elastic_monitors_operations_test.py | 4 ++-- .../tests/test_microsoft_elastic_operations_async_test.py | 4 ++-- .../tests/test_microsoft_elastic_operations_test.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_monitors_operations_async_test.py b/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_monitors_operations_async_test.py index c94d384637ea..6f3c4cca41c0 100644 --- a/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_monitors_operations_async_test.py +++ b/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_monitors_operations_async_test.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -17,7 +17,7 @@ @pytest.mark.live_test_only class TestMicrosoftElasticMonitorsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_monitors_operations_test.py b/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_monitors_operations_test.py index abf286bb1d9b..4dd958e13f2c 100644 --- a/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_monitors_operations_test.py +++ b/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_monitors_operations_test.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -16,7 +16,7 @@ @pytest.mark.live_test_only class TestMicrosoftElasticMonitorsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_operations_async_test.py b/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_operations_async_test.py index fb5764f7c1e8..c33316604399 100644 --- a/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_operations_async_test.py +++ b/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_operations_async_test.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic.aio import MicrosoftElastic +from azure.mgmt.elastic.aio import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -17,7 +17,7 @@ @pytest.mark.live_test_only class TestMicrosoftElasticOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic, is_async=True) + self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_operations_test.py b/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_operations_test.py index b3d705b311b5..d2eea67991c7 100644 --- a/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_operations_test.py +++ b/sdk/elastic/azure-mgmt-elastic/tests/test_microsoft_elastic_operations_test.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.elastic import MicrosoftElastic +from azure.mgmt.elastic import ElasticMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -16,7 +16,7 @@ @pytest.mark.live_test_only class TestMicrosoftElasticOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftElastic) + self.client = self.create_mgmt_client(ElasticMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy From 1ea919564cce586de32cb6dc6c9d66aa849a18d5 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 7 Jul 2026 02:43:02 +0000 Subject: [PATCH 4/5] Configurations: 'specification/elastic/Elastic.Management/tspconfig.yaml', API Version: 2025-06-01, SDK Release Type: beta, and CommitSHA: '74d1bc903079523fec5c65b24b2770e6e06f14fa' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6526629 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/elastic/azure-mgmt-elastic/CHANGELOG.md | 25 +- sdk/elastic/azure-mgmt-elastic/_metadata.json | 2 +- sdk/elastic/azure-mgmt-elastic/api.md | 244 +++++++++--------- .../azure-mgmt-elastic/api.metadata.yml | 4 +- .../apiview-properties.json | 14 +- .../azure/mgmt/elastic/_client.py | 24 +- .../azure/mgmt/elastic/aio/_client.py | 24 +- .../mgmt/elastic/aio/operations/__init__.py | 12 +- .../elastic/aio/operations/_operations.py | 6 +- .../azure/mgmt/elastic/operations/__init__.py | 12 +- .../mgmt/elastic/operations/_operations.py | 6 +- ...ate_and_associate_ip_filter_operations.py} | 2 +- ...d_associate_ip_filter_operations_async.py} | 2 +- ...ate_and_associate_pl_filter_operations.py} | 2 +- ...d_associate_pl_filter_operations_async.py} | 2 +- ..._associated_traffic_filters_operations.py} | 2 +- ...iated_traffic_filters_operations_async.py} | 2 +- .../azure-mgmt-elastic/tsp-location.yaml | 2 +- 18 files changed, 197 insertions(+), 190 deletions(-) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_elastic_mgmtcreate_and_associate_ip_filter_operations.py => test_elastic_mgmt_create_and_associate_ip_filter_operations.py} (95%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_elastic_mgmtcreate_and_associate_ip_filter_operations_async.py => test_elastic_mgmt_create_and_associate_ip_filter_operations_async.py} (95%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_elastic_mgmtcreate_and_associate_pl_filter_operations.py => test_elastic_mgmt_create_and_associate_pl_filter_operations.py} (95%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_elastic_mgmtcreate_and_associate_pl_filter_operations_async.py => test_elastic_mgmt_create_and_associate_pl_filter_operations_async.py} (95%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_elastic_mgmtlist_associated_traffic_filters_operations.py => test_elastic_mgmt_list_associated_traffic_filters_operations.py} (95%) rename sdk/elastic/azure-mgmt-elastic/generated_tests/{test_elastic_mgmtlist_associated_traffic_filters_operations_async.py => test_elastic_mgmt_list_associated_traffic_filters_operations_async.py} (95%) diff --git a/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md b/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md index 555677739106..8fe5dc7d0531 100644 --- a/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md +++ b/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 3.0.0b1 (2026-07-06) +## 3.0.0b1 (2026-07-07) ### Features Added @@ -12,19 +12,26 @@ ### Breaking Changes - - Renamed client `MicrosoftElastic` to `ElasticMgmtClient` + - Deleted or renamed model `MicrosoftElastic` + - Deleted or renamed model `ConnectedPartnerResourcesListResponse` + - Deleted or renamed model `ElasticMonitorResourceListResponse` + - Deleted or renamed model `ElasticVersionsListResponse` + - Deleted or renamed model `MonitoredResourceListResponse` + - Deleted or renamed model `MonitoredSubscriptionPropertiesList` + - Deleted or renamed model `MonitoringTagRulesListResponse` + - Deleted or renamed model `OpenAIIntegrationRPModelListResponse` + - Deleted or renamed model `OperationListResult` + - Deleted or renamed model `VMHostListResponse` - Method `AssociateTrafficFilterOperations.begin_associate` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` + - Method `CreateAndAssociateIPFilterOperations.begin_create` changed its parameter `ips` from `positional_or_keyword` to `keyword_only` + - Method `CreateAndAssociateIPFilterOperations.begin_create` changed its parameter `name` from `positional_or_keyword` to `keyword_only` + - Method `CreateAndAssociatePLFilterOperations.begin_create` changed its parameter `name` from `positional_or_keyword` to `keyword_only` + - Method `CreateAndAssociatePLFilterOperations.begin_create` changed its parameter `private_endpoint_guid` from `positional_or_keyword` to `keyword_only` + - Method `CreateAndAssociatePLFilterOperations.begin_create` changed its parameter `private_endpoint_name` from `positional_or_keyword` to `keyword_only` - Method `DetachAndDeleteTrafficFilterOperations.delete` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - Method `DetachTrafficFilterOperations.begin_update` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - Method `ElasticVersionsOperations.list` changed its parameter `region` from `positional_or_keyword` to `keyword_only` - Method `TrafficFiltersOperations.delete` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - - Renamed operation group `CreateAndAssociateIPFilterOperations` to `createAndAssociateIPFilterOperations` - - Renamed operation group `CreateAndAssociatePLFilterOperations` to `createAndAssociatePLFilterOperations` - - Renamed operation group `ListAssociatedTrafficFiltersOperations` to `listAssociatedTrafficFiltersOperations` - -### Other Changes - - - Deleted model `ConnectedPartnerResourcesListResponse`/`ElasticMonitorResourceListResponse`/`ElasticVersionsListResponse`/`MonitoredResourceListResponse`/`MonitoredSubscriptionPropertiesList`/`MonitoringTagRulesListResponse`/`OpenAIIntegrationRPModelListResponse`/`OperationListResult`/`VMHostListResponse` which actually were not used by SDK users ## 2.0.0 (2025-11-17) diff --git a/sdk/elastic/azure-mgmt-elastic/_metadata.json b/sdk/elastic/azure-mgmt-elastic/_metadata.json index 49ccf9664c1c..23dd709f946f 100644 --- a/sdk/elastic/azure-mgmt-elastic/_metadata.json +++ b/sdk/elastic/azure-mgmt-elastic/_metadata.json @@ -3,7 +3,7 @@ "apiVersions": { "Microsoft.Elastic": "2025-06-01" }, - "commit": "3d1de464b5576fa149aed429795f6030313e31bb", + "commit": "74d1bc903079523fec5c65b24b2770e6e06f14fa", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/elastic/Elastic.Management", "emitterVersion": "0.63.2", diff --git a/sdk/elastic/azure-mgmt-elastic/api.md b/sdk/elastic/azure-mgmt-elastic/api.md index acce32ee5858..f8c935f7bf28 100644 --- a/sdk/elastic/azure-mgmt-elastic/api.md +++ b/sdk/elastic/azure-mgmt-elastic/api.md @@ -6,14 +6,14 @@ namespace azure.mgmt.elastic associate_traffic_filter: AssociateTrafficFilterOperations billing_info: BillingInfoOperations connected_partner_resources: ConnectedPartnerResourcesOperations - create_and_associate_ip_filter: createAndAssociateIPFilterOperations - create_and_associate_pl_filter: createAndAssociatePLFilterOperations + create_and_associate_ip_filter: CreateAndAssociateIPFilterOperations + create_and_associate_pl_filter: CreateAndAssociatePLFilterOperations deployment_info: DeploymentInfoOperations detach_and_delete_traffic_filter: DetachAndDeleteTrafficFilterOperations detach_traffic_filter: DetachTrafficFilterOperations elastic_versions: ElasticVersionsOperations external_user: ExternalUserOperations - list_associated_traffic_filters: listAssociatedTrafficFiltersOperations + list_associated_traffic_filters: ListAssociatedTrafficFiltersOperations monitor: MonitorOperations monitored_resources: MonitoredResourcesOperations monitored_subscriptions: MonitoredSubscriptionsOperations @@ -58,14 +58,14 @@ namespace azure.mgmt.elastic.aio associate_traffic_filter: AssociateTrafficFilterOperations billing_info: BillingInfoOperations connected_partner_resources: ConnectedPartnerResourcesOperations - create_and_associate_ip_filter: createAndAssociateIPFilterOperations - create_and_associate_pl_filter: createAndAssociatePLFilterOperations + create_and_associate_ip_filter: CreateAndAssociateIPFilterOperations + create_and_associate_pl_filter: CreateAndAssociatePLFilterOperations deployment_info: DeploymentInfoOperations detach_and_delete_traffic_filter: DetachAndDeleteTrafficFilterOperations detach_traffic_filter: DetachTrafficFilterOperations elastic_versions: ElasticVersionsOperations external_user: ExternalUserOperations - list_associated_traffic_filters: listAssociatedTrafficFiltersOperations + list_associated_traffic_filters: ListAssociatedTrafficFiltersOperations monitor: MonitorOperations monitored_resources: MonitoredResourcesOperations monitored_subscriptions: MonitoredSubscriptionsOperations @@ -175,6 +175,47 @@ namespace azure.mgmt.elastic.aio.operations ) -> AsyncItemPaged[ConnectedPartnerResourcesListFormat]: ... + class azure.mgmt.elastic.aio.operations.CreateAndAssociateIPFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + ips: Optional[str] = ..., + name: Optional[str] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + + class azure.mgmt.elastic.aio.operations.CreateAndAssociatePLFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + name: Optional[str] = ..., + private_endpoint_guid: Optional[str] = ..., + private_endpoint_name: Optional[str] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + class azure.mgmt.elastic.aio.operations.DeploymentInfoOperations: def __init__( @@ -289,6 +330,23 @@ namespace azure.mgmt.elastic.aio.operations ) -> ExternalUserCreationResponse: ... + class azure.mgmt.elastic.aio.operations.ListAssociatedTrafficFiltersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ElasticTrafficFilterResponse: ... + + class azure.mgmt.elastic.aio.operations.MonitorOperations: def __init__( @@ -903,64 +961,6 @@ namespace azure.mgmt.elastic.aio.operations ) -> VMIngestionDetailsResponse: ... - class azure.mgmt.elastic.aio.operations.createAndAssociateIPFilterOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - monitor_name: str, - *, - ips: Optional[str] = ..., - name: Optional[str] = ..., - **kwargs: Any - ) -> AsyncLROPoller[None]: ... - - - class azure.mgmt.elastic.aio.operations.createAndAssociatePLFilterOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - monitor_name: str, - *, - name: Optional[str] = ..., - private_endpoint_guid: Optional[str] = ..., - private_endpoint_name: Optional[str] = ..., - **kwargs: Any - ) -> AsyncLROPoller[None]: ... - - - class azure.mgmt.elastic.aio.operations.listAssociatedTrafficFiltersOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs: Any - ) -> ElasticTrafficFilterResponse: ... - - namespace azure.mgmt.elastic.models class azure.mgmt.elastic.models.BillingInfoResponse(_Model): @@ -2125,6 +2125,47 @@ namespace azure.mgmt.elastic.operations ) -> ItemPaged[ConnectedPartnerResourcesListFormat]: ... + class azure.mgmt.elastic.operations.CreateAndAssociateIPFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + ips: Optional[str] = ..., + name: Optional[str] = ..., + **kwargs: Any + ) -> LROPoller[None]: ... + + + class azure.mgmt.elastic.operations.CreateAndAssociatePLFilterOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + *, + name: Optional[str] = ..., + private_endpoint_guid: Optional[str] = ..., + private_endpoint_name: Optional[str] = ..., + **kwargs: Any + ) -> LROPoller[None]: ... + + class azure.mgmt.elastic.operations.DeploymentInfoOperations: def __init__( @@ -2239,6 +2280,23 @@ namespace azure.mgmt.elastic.operations ) -> ExternalUserCreationResponse: ... + class azure.mgmt.elastic.operations.ListAssociatedTrafficFiltersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> ElasticTrafficFilterResponse: ... + + class azure.mgmt.elastic.operations.MonitorOperations: def __init__( @@ -2853,64 +2911,6 @@ namespace azure.mgmt.elastic.operations ) -> VMIngestionDetailsResponse: ... - class azure.mgmt.elastic.operations.createAndAssociateIPFilterOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - monitor_name: str, - *, - ips: Optional[str] = ..., - name: Optional[str] = ..., - **kwargs: Any - ) -> LROPoller[None]: ... - - - class azure.mgmt.elastic.operations.createAndAssociatePLFilterOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - monitor_name: str, - *, - name: Optional[str] = ..., - private_endpoint_guid: Optional[str] = ..., - private_endpoint_name: Optional[str] = ..., - **kwargs: Any - ) -> LROPoller[None]: ... - - - class azure.mgmt.elastic.operations.listAssociatedTrafficFiltersOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs: Any - ) -> ElasticTrafficFilterResponse: ... - - namespace azure.mgmt.elastic.types class azure.mgmt.elastic.types.BillingInfoResponse(TypedDict, total=False): diff --git a/sdk/elastic/azure-mgmt-elastic/api.metadata.yml b/sdk/elastic/azure-mgmt-elastic/api.metadata.yml index 0b1b05372698..6468e72306e7 100644 --- a/sdk/elastic/azure-mgmt-elastic/api.metadata.yml +++ b/sdk/elastic/azure-mgmt-elastic/api.metadata.yml @@ -1,3 +1,3 @@ -apiMdSha256: aae05c0c77675eb2f5675c5f45bb4cfe2e77e325289753faafd540910d95c378 +apiMdSha256: 4a1487d0fedeba7aa15eece8e9bc79eddd1d368bc4ff83f769a18a2e4474013f parserVersion: 0.3.28 -pythonVersion: 3.13.13 +pythonVersion: 3.13.14 diff --git a/sdk/elastic/azure-mgmt-elastic/apiview-properties.json b/sdk/elastic/azure-mgmt-elastic/apiview-properties.json index 618e7db142da..f22bd28de1c8 100644 --- a/sdk/elastic/azure-mgmt-elastic/apiview-properties.json +++ b/sdk/elastic/azure-mgmt-elastic/apiview-properties.json @@ -130,12 +130,12 @@ "azure.mgmt.elastic.aio.operations.MonitorOperations.begin_upgrade": "Microsoft.Elastic.ElasticMonitorResources.upgrade", "azure.mgmt.elastic.operations.AllTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.allTrafficFiltersList", "azure.mgmt.elastic.aio.operations.AllTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.allTrafficFiltersList", - "azure.mgmt.elastic.operations.listAssociatedTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.listAssociatedTrafficFiltersList", - "azure.mgmt.elastic.aio.operations.listAssociatedTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.listAssociatedTrafficFiltersList", - "azure.mgmt.elastic.operations.createAndAssociateIPFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociateIPFilterCreate", - "azure.mgmt.elastic.aio.operations.createAndAssociateIPFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociateIPFilterCreate", - "azure.mgmt.elastic.operations.createAndAssociatePLFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociatePLFilterCreate", - "azure.mgmt.elastic.aio.operations.createAndAssociatePLFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociatePLFilterCreate", + "azure.mgmt.elastic.operations.ListAssociatedTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.listAssociatedTrafficFiltersList", + "azure.mgmt.elastic.aio.operations.ListAssociatedTrafficFiltersOperations.list": "Microsoft.Elastic.ElasticMonitorResources.listAssociatedTrafficFiltersList", + "azure.mgmt.elastic.operations.CreateAndAssociateIPFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociateIPFilterCreate", + "azure.mgmt.elastic.aio.operations.CreateAndAssociateIPFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociateIPFilterCreate", + "azure.mgmt.elastic.operations.CreateAndAssociatePLFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociatePLFilterCreate", + "azure.mgmt.elastic.aio.operations.CreateAndAssociatePLFilterOperations.begin_create": "Microsoft.Elastic.ElasticMonitorResources.createAndAssociatePLFilterCreate", "azure.mgmt.elastic.operations.AssociateTrafficFilterOperations.begin_associate": "Microsoft.Elastic.ElasticMonitorResources.associate", "azure.mgmt.elastic.aio.operations.AssociateTrafficFilterOperations.begin_associate": "Microsoft.Elastic.ElasticMonitorResources.associate", "azure.mgmt.elastic.operations.DetachAndDeleteTrafficFilterOperations.delete": "Microsoft.Elastic.ElasticMonitorResources.detachAndDeleteTrafficFilterDelete", @@ -163,5 +163,5 @@ "azure.mgmt.elastic.operations.ElasticVersionsOperations.list": "Microsoft.Elastic.ElasticVersionsOperationGroup.list", "azure.mgmt.elastic.aio.operations.ElasticVersionsOperations.list": "Microsoft.Elastic.ElasticVersionsOperationGroup.list" }, - "CrossLanguageVersion": "17c14004697f" + "CrossLanguageVersion": "40749611ebbc" } \ No newline at end of file diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_client.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_client.py index e08b7cde318d..534f5a75fc6a 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_client.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_client.py @@ -24,11 +24,14 @@ AssociateTrafficFilterOperations, BillingInfoOperations, ConnectedPartnerResourcesOperations, + CreateAndAssociateIPFilterOperations, + CreateAndAssociatePLFilterOperations, DeploymentInfoOperations, DetachAndDeleteTrafficFilterOperations, DetachTrafficFilterOperations, ElasticVersionsOperations, ExternalUserOperations, + ListAssociatedTrafficFiltersOperations, MonitorOperations, MonitoredResourcesOperations, MonitoredSubscriptionsOperations, @@ -42,9 +45,6 @@ VMCollectionOperations, VMHostOperations, VMIngestionOperations, - createAndAssociateIPFilterOperations, - createAndAssociatePLFilterOperations, - listAssociatedTrafficFiltersOperations, ) if sys.version_info >= (3, 11): @@ -92,15 +92,15 @@ class ElasticMgmtClient: # pylint: disable=too-many-instance-attributes :vartype monitor: azure.mgmt.elastic.operations.MonitorOperations :ivar all_traffic_filters: AllTrafficFiltersOperations operations :vartype all_traffic_filters: azure.mgmt.elastic.operations.AllTrafficFiltersOperations - :ivar list_associated_traffic_filters: listAssociatedTrafficFiltersOperations operations + :ivar list_associated_traffic_filters: ListAssociatedTrafficFiltersOperations operations :vartype list_associated_traffic_filters: - azure.mgmt.elastic.operations.listAssociatedTrafficFiltersOperations - :ivar create_and_associate_ip_filter: createAndAssociateIPFilterOperations operations + azure.mgmt.elastic.operations.ListAssociatedTrafficFiltersOperations + :ivar create_and_associate_ip_filter: CreateAndAssociateIPFilterOperations operations :vartype create_and_associate_ip_filter: - azure.mgmt.elastic.operations.createAndAssociateIPFilterOperations - :ivar create_and_associate_pl_filter: createAndAssociatePLFilterOperations operations + azure.mgmt.elastic.operations.CreateAndAssociateIPFilterOperations + :ivar create_and_associate_pl_filter: CreateAndAssociatePLFilterOperations operations :vartype create_and_associate_pl_filter: - azure.mgmt.elastic.operations.createAndAssociatePLFilterOperations + azure.mgmt.elastic.operations.CreateAndAssociatePLFilterOperations :ivar associate_traffic_filter: AssociateTrafficFilterOperations operations :vartype associate_traffic_filter: azure.mgmt.elastic.operations.AssociateTrafficFilterOperations @@ -206,13 +206,13 @@ def __init__( self.all_traffic_filters = AllTrafficFiltersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.list_associated_traffic_filters = listAssociatedTrafficFiltersOperations( + self.list_associated_traffic_filters = ListAssociatedTrafficFiltersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.create_and_associate_ip_filter = createAndAssociateIPFilterOperations( + self.create_and_associate_ip_filter = CreateAndAssociateIPFilterOperations( self._client, self._config, self._serialize, self._deserialize ) - self.create_and_associate_pl_filter = createAndAssociatePLFilterOperations( + self.create_and_associate_pl_filter = CreateAndAssociatePLFilterOperations( self._client, self._config, self._serialize, self._deserialize ) self.associate_traffic_filter = AssociateTrafficFilterOperations( diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_client.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_client.py index c8b4d7900394..e084f121c59a 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_client.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_client.py @@ -24,11 +24,14 @@ AssociateTrafficFilterOperations, BillingInfoOperations, ConnectedPartnerResourcesOperations, + CreateAndAssociateIPFilterOperations, + CreateAndAssociatePLFilterOperations, DeploymentInfoOperations, DetachAndDeleteTrafficFilterOperations, DetachTrafficFilterOperations, ElasticVersionsOperations, ExternalUserOperations, + ListAssociatedTrafficFiltersOperations, MonitorOperations, MonitoredResourcesOperations, MonitoredSubscriptionsOperations, @@ -42,9 +45,6 @@ VMCollectionOperations, VMHostOperations, VMIngestionOperations, - createAndAssociateIPFilterOperations, - createAndAssociatePLFilterOperations, - listAssociatedTrafficFiltersOperations, ) if sys.version_info >= (3, 11): @@ -92,15 +92,15 @@ class ElasticMgmtClient: # pylint: disable=too-many-instance-attributes :vartype monitor: azure.mgmt.elastic.aio.operations.MonitorOperations :ivar all_traffic_filters: AllTrafficFiltersOperations operations :vartype all_traffic_filters: azure.mgmt.elastic.aio.operations.AllTrafficFiltersOperations - :ivar list_associated_traffic_filters: listAssociatedTrafficFiltersOperations operations + :ivar list_associated_traffic_filters: ListAssociatedTrafficFiltersOperations operations :vartype list_associated_traffic_filters: - azure.mgmt.elastic.aio.operations.listAssociatedTrafficFiltersOperations - :ivar create_and_associate_ip_filter: createAndAssociateIPFilterOperations operations + azure.mgmt.elastic.aio.operations.ListAssociatedTrafficFiltersOperations + :ivar create_and_associate_ip_filter: CreateAndAssociateIPFilterOperations operations :vartype create_and_associate_ip_filter: - azure.mgmt.elastic.aio.operations.createAndAssociateIPFilterOperations - :ivar create_and_associate_pl_filter: createAndAssociatePLFilterOperations operations + azure.mgmt.elastic.aio.operations.CreateAndAssociateIPFilterOperations + :ivar create_and_associate_pl_filter: CreateAndAssociatePLFilterOperations operations :vartype create_and_associate_pl_filter: - azure.mgmt.elastic.aio.operations.createAndAssociatePLFilterOperations + azure.mgmt.elastic.aio.operations.CreateAndAssociatePLFilterOperations :ivar associate_traffic_filter: AssociateTrafficFilterOperations operations :vartype associate_traffic_filter: azure.mgmt.elastic.aio.operations.AssociateTrafficFilterOperations @@ -208,13 +208,13 @@ def __init__( self.all_traffic_filters = AllTrafficFiltersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.list_associated_traffic_filters = listAssociatedTrafficFiltersOperations( + self.list_associated_traffic_filters = ListAssociatedTrafficFiltersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.create_and_associate_ip_filter = createAndAssociateIPFilterOperations( + self.create_and_associate_ip_filter = CreateAndAssociateIPFilterOperations( self._client, self._config, self._serialize, self._deserialize ) - self.create_and_associate_pl_filter = createAndAssociatePLFilterOperations( + self.create_and_associate_pl_filter = CreateAndAssociatePLFilterOperations( self._client, self._config, self._serialize, self._deserialize ) self.associate_traffic_filter = AssociateTrafficFilterOperations( diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py index 829239b82bd0..d7f1c53f7527 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py @@ -27,9 +27,9 @@ from ._operations import UpgradableVersionsOperations # type: ignore from ._operations import MonitorOperations # type: ignore from ._operations import AllTrafficFiltersOperations # type: ignore -from ._operations import listAssociatedTrafficFiltersOperations # type: ignore -from ._operations import createAndAssociateIPFilterOperations # type: ignore -from ._operations import createAndAssociatePLFilterOperations # type: ignore +from ._operations import ListAssociatedTrafficFiltersOperations # type: ignore +from ._operations import CreateAndAssociateIPFilterOperations # type: ignore +from ._operations import CreateAndAssociatePLFilterOperations # type: ignore from ._operations import AssociateTrafficFilterOperations # type: ignore from ._operations import DetachAndDeleteTrafficFilterOperations # type: ignore from ._operations import DetachTrafficFilterOperations # type: ignore @@ -58,9 +58,9 @@ "UpgradableVersionsOperations", "MonitorOperations", "AllTrafficFiltersOperations", - "listAssociatedTrafficFiltersOperations", - "createAndAssociateIPFilterOperations", - "createAndAssociatePLFilterOperations", + "ListAssociatedTrafficFiltersOperations", + "CreateAndAssociateIPFilterOperations", + "CreateAndAssociatePLFilterOperations", "AssociateTrafficFilterOperations", "DetachAndDeleteTrafficFilterOperations", "DetachTrafficFilterOperations", diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py index 6c5c5b4979b3..ae7f65b42599 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py @@ -3920,7 +3920,7 @@ async def list( return deserialized # type: ignore -class listAssociatedTrafficFiltersOperations: +class ListAssociatedTrafficFiltersOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -4012,7 +4012,7 @@ async def list( return deserialized # type: ignore -class createAndAssociateIPFilterOperations: +class CreateAndAssociateIPFilterOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -4171,7 +4171,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class createAndAssociatePLFilterOperations: +class CreateAndAssociatePLFilterOperations: """ .. warning:: **DO NOT** instantiate this class directly. diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py index 829239b82bd0..d7f1c53f7527 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py @@ -27,9 +27,9 @@ from ._operations import UpgradableVersionsOperations # type: ignore from ._operations import MonitorOperations # type: ignore from ._operations import AllTrafficFiltersOperations # type: ignore -from ._operations import listAssociatedTrafficFiltersOperations # type: ignore -from ._operations import createAndAssociateIPFilterOperations # type: ignore -from ._operations import createAndAssociatePLFilterOperations # type: ignore +from ._operations import ListAssociatedTrafficFiltersOperations # type: ignore +from ._operations import CreateAndAssociateIPFilterOperations # type: ignore +from ._operations import CreateAndAssociatePLFilterOperations # type: ignore from ._operations import AssociateTrafficFilterOperations # type: ignore from ._operations import DetachAndDeleteTrafficFilterOperations # type: ignore from ._operations import DetachTrafficFilterOperations # type: ignore @@ -58,9 +58,9 @@ "UpgradableVersionsOperations", "MonitorOperations", "AllTrafficFiltersOperations", - "listAssociatedTrafficFiltersOperations", - "createAndAssociateIPFilterOperations", - "createAndAssociatePLFilterOperations", + "ListAssociatedTrafficFiltersOperations", + "CreateAndAssociateIPFilterOperations", + "CreateAndAssociatePLFilterOperations", "AssociateTrafficFilterOperations", "DetachAndDeleteTrafficFilterOperations", "DetachTrafficFilterOperations", diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py index e45d9c545f03..8eb1e6107303 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py @@ -5081,7 +5081,7 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m return deserialized # type: ignore -class listAssociatedTrafficFiltersOperations: +class ListAssociatedTrafficFiltersOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -5171,7 +5171,7 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m return deserialized # type: ignore -class createAndAssociateIPFilterOperations: +class CreateAndAssociateIPFilterOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -5330,7 +5330,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class createAndAssociatePLFilterOperations: +class CreateAndAssociatePLFilterOperations: """ .. warning:: **DO NOT** instantiate this class directly. diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_ip_filter_operations.py similarity index 95% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_ip_filter_operations.py index 028dd305f6cc..dafc15d36fca 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_ip_filter_operations.py @@ -14,7 +14,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestElasticMgmtcreateAndAssociateIPFilterOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtCreateAndAssociateIPFilterOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ElasticMgmtClient) diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_ip_filter_operations_async.py similarity index 95% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_ip_filter_operations_async.py index 8471100e5172..e4ceb810dbd2 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_ip_filter_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_ip_filter_operations_async.py @@ -15,7 +15,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestElasticMgmtcreateAndAssociateIPFilterOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtCreateAndAssociateIPFilterOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_pl_filter_operations.py similarity index 95% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_pl_filter_operations.py index d31b7dac85cc..94af20c7b550 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_pl_filter_operations.py @@ -14,7 +14,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestElasticMgmtcreateAndAssociatePLFilterOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtCreateAndAssociatePLFilterOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ElasticMgmtClient) diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_pl_filter_operations_async.py similarity index 95% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_pl_filter_operations_async.py index 7fd76efb7478..9a7575f5bb19 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtcreate_and_associate_pl_filter_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_create_and_associate_pl_filter_operations_async.py @@ -15,7 +15,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestElasticMgmtcreateAndAssociatePLFilterOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtCreateAndAssociatePLFilterOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_list_associated_traffic_filters_operations.py similarity index 95% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_list_associated_traffic_filters_operations.py index 654fe862b625..d1465eeff25f 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_list_associated_traffic_filters_operations.py @@ -14,7 +14,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestElasticMgmtlistAssociatedTrafficFiltersOperations(AzureMgmtRecordedTestCase): +class TestElasticMgmtListAssociatedTrafficFiltersOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ElasticMgmtClient) diff --git a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations_async.py b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_list_associated_traffic_filters_operations_async.py similarity index 95% rename from sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations_async.py rename to sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_list_associated_traffic_filters_operations_async.py index a78f72cb63b4..0f7768761747 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmtlist_associated_traffic_filters_operations_async.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_tests/test_elastic_mgmt_list_associated_traffic_filters_operations_async.py @@ -15,7 +15,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestElasticMgmtlistAssociatedTrafficFiltersOperationsAsync(AzureMgmtRecordedTestCase): +class TestElasticMgmtListAssociatedTrafficFiltersOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ElasticMgmtClient, is_async=True) diff --git a/sdk/elastic/azure-mgmt-elastic/tsp-location.yaml b/sdk/elastic/azure-mgmt-elastic/tsp-location.yaml index 55b41c1a7e32..abcf7eb62c6c 100644 --- a/sdk/elastic/azure-mgmt-elastic/tsp-location.yaml +++ b/sdk/elastic/azure-mgmt-elastic/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/elastic/Elastic.Management -commit: 3d1de464b5576fa149aed429795f6030313e31bb +commit: 74d1bc903079523fec5c65b24b2770e6e06f14fa repo: Azure/azure-rest-api-specs additionalDirectories: From 92be238ac7d88a7df440da4e92eb7b3e7d395b66 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 7 Jul 2026 10:48:58 +0800 Subject: [PATCH 5/5] Optimize changelog for azure-mgmt-elastic --- sdk/elastic/azure-mgmt-elastic/CHANGELOG.md | 23 +++++++-------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md b/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md index 8fe5dc7d0531..66bd8e0a0723 100644 --- a/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md +++ b/sdk/elastic/azure-mgmt-elastic/CHANGELOG.md @@ -12,27 +12,20 @@ ### Breaking Changes - - Deleted or renamed model `MicrosoftElastic` - - Deleted or renamed model `ConnectedPartnerResourcesListResponse` - - Deleted or renamed model `ElasticMonitorResourceListResponse` - - Deleted or renamed model `ElasticVersionsListResponse` - - Deleted or renamed model `MonitoredResourceListResponse` - - Deleted or renamed model `MonitoredSubscriptionPropertiesList` - - Deleted or renamed model `MonitoringTagRulesListResponse` - - Deleted or renamed model `OpenAIIntegrationRPModelListResponse` - - Deleted or renamed model `OperationListResult` - - Deleted or renamed model `VMHostListResponse` + - For the method breakings, please refer to https://aka.ms/azsdk/python/migrate/operations for migration. + - Renamed client `MicrosoftElastic` to `ElasticMgmtClient` - Method `AssociateTrafficFilterOperations.begin_associate` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - - Method `CreateAndAssociateIPFilterOperations.begin_create` changed its parameter `ips` from `positional_or_keyword` to `keyword_only` - - Method `CreateAndAssociateIPFilterOperations.begin_create` changed its parameter `name` from `positional_or_keyword` to `keyword_only` - - Method `CreateAndAssociatePLFilterOperations.begin_create` changed its parameter `name` from `positional_or_keyword` to `keyword_only` - - Method `CreateAndAssociatePLFilterOperations.begin_create` changed its parameter `private_endpoint_guid` from `positional_or_keyword` to `keyword_only` - - Method `CreateAndAssociatePLFilterOperations.begin_create` changed its parameter `private_endpoint_name` from `positional_or_keyword` to `keyword_only` + - Method `CreateAndAssociateIPFilterOperations.begin_create` changed its parameter `ips`/`name` from `positional_or_keyword` to `keyword_only` + - Method `CreateAndAssociatePLFilterOperations.begin_create` changed its parameter `name`/`private_endpoint_guid`/`private_endpoint_name` from `positional_or_keyword` to `keyword_only` - Method `DetachAndDeleteTrafficFilterOperations.delete` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - Method `DetachTrafficFilterOperations.begin_update` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` - Method `ElasticVersionsOperations.list` changed its parameter `region` from `positional_or_keyword` to `keyword_only` - Method `TrafficFiltersOperations.delete` changed its parameter `ruleset_id` from `positional_or_keyword` to `keyword_only` +### Other Changes + + - Deleted model `ConnectedPartnerResourcesListResponse`/`ElasticMonitorResourceListResponse`/`ElasticVersionsListResponse`/`MonitoredResourceListResponse`/`MonitoredSubscriptionPropertiesList`/`MonitoringTagRulesListResponse`/`OpenAIIntegrationRPModelListResponse`/`OperationListResult`/`VMHostListResponse` which actually were not used by SDK users + ## 2.0.0 (2025-11-17) ### Features Added