From 74a8357d9b87bfe32d06afe7f1c5a762300b38f4 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 30 Oct 2024 06:14:46 +0000 Subject: [PATCH 1/4] code and test --- .../azure-mgmt-resourcehealth/CHANGELOG.md | 4 + .../azure-mgmt-resourcehealth/README.md | 4 +- .../azure-mgmt-resourcehealth/_meta.json | 10 +- .../azure/mgmt/resourcehealth/__init__.py | 18 +- .../mgmt/resourcehealth/_configuration.py | 58 +- .../{v2015_01_01 => }/_patch.py | 0 .../_resource_health_mgmt_client.py | 384 +-- .../mgmt/resourcehealth/_serialization.py | 108 +- .../azure/mgmt/resourcehealth/_version.py | 7 +- .../azure/mgmt/resourcehealth/aio/__init__.py | 15 +- .../mgmt/resourcehealth/aio/_configuration.py | 58 +- .../{v2015_01_01 => }/aio/_patch.py | 0 .../aio/_resource_health_mgmt_client.py | 393 +-- .../aio/operations/__init__.py | 0 .../_availability_statuses_operations.py | 127 +- ..._child_availability_statuses_operations.py | 69 +- .../operations/_child_resources_operations.py | 44 +- .../operations/_emerging_issues_operations.py | 69 +- .../aio/operations/_event_operations.py | 120 +- .../aio/operations/_events_operations.py | 105 +- .../_impacted_resources_operations.py | 126 +- .../aio/operations/_metadata_operations.py | 67 +- .../aio/operations/_operations.py | 39 +- .../aio/operations/_patch.py | 0 ..._advisory_impacted_resources_operations.py | 78 +- .../azure/mgmt/resourcehealth/models.py | 7 - .../models/__init__.py | 0 .../models/_models_py3.py | 289 +-- .../{v2015_01_01 => }/models/_patch.py | 0 .../_resource_health_mgmt_client_enums.py | 0 .../{v2022_10_01 => }/operations/__init__.py | 0 .../_availability_statuses_operations.py | 140 +- ..._child_availability_statuses_operations.py | 76 +- .../operations/_child_resources_operations.py | 49 +- .../operations/_emerging_issues_operations.py | 76 +- .../operations/_event_operations.py | 142 +- .../operations/_events_operations.py | 110 +- .../_impacted_resources_operations.py | 142 +- .../operations/_metadata_operations.py | 74 +- .../operations/_operations.py | 43 +- .../{v2015_01_01 => }/operations/_patch.py | 0 ..._advisory_impacted_resources_operations.py | 90 +- .../resourcehealth/v2015_01_01/__init__.py | 26 - .../v2015_01_01/_configuration.py | 67 - .../resourcehealth/v2015_01_01/_metadata.json | 113 - .../_resource_health_mgmt_client.py | 113 - .../resourcehealth/v2015_01_01/_vendor.py | 16 - .../resourcehealth/v2015_01_01/_version.py | 9 - .../v2015_01_01/aio/__init__.py | 23 - .../v2015_01_01/aio/_configuration.py | 67 - .../aio/_resource_health_mgmt_client.py | 113 - .../v2015_01_01/aio/operations/__init__.py | 25 - .../_availability_statuses_operations.py | 428 ---- ..._child_availability_statuses_operations.py | 226 -- .../operations/_child_resources_operations.py | 153 -- .../v2015_01_01/aio/operations/_operations.py | 105 - .../v2015_01_01/models/__init__.py | 45 - .../v2015_01_01/models/_models_py3.py | 622 ----- .../_resource_health_mgmt_client_enums.py | 25 - .../v2015_01_01/operations/__init__.py | 25 - .../_availability_statuses_operations.py | 556 ----- ..._child_availability_statuses_operations.py | 290 --- .../mgmt/resourcehealth/v2015_01_01/py.typed | 1 - .../resourcehealth/v2018_07_01/__init__.py | 26 - .../v2018_07_01/_configuration.py | 67 - .../resourcehealth/v2018_07_01/_metadata.json | 114 - .../mgmt/resourcehealth/v2018_07_01/_patch.py | 20 - .../_resource_health_mgmt_client.py | 114 - .../resourcehealth/v2018_07_01/_vendor.py | 16 - .../resourcehealth/v2018_07_01/_version.py | 9 - .../v2018_07_01/aio/__init__.py | 23 - .../v2018_07_01/aio/_configuration.py | 67 - .../resourcehealth/v2018_07_01/aio/_patch.py | 20 - .../aio/_resource_health_mgmt_client.py | 114 - .../v2018_07_01/aio/operations/__init__.py | 27 - .../_availability_statuses_operations.py | 433 ---- .../operations/_emerging_issues_operations.py | 193 -- .../aio/operations/_events_operations.py | 263 -- .../v2018_07_01/aio/operations/_patch.py | 20 - .../v2018_07_01/models/__init__.py | 107 - .../v2018_07_01/models/_models_py3.py | 1732 ------------- .../v2018_07_01/models/_patch.py | 20 - .../_resource_health_mgmt_client_enums.py | 104 - .../v2018_07_01/operations/__init__.py | 27 - .../_availability_statuses_operations.py | 561 ----- .../operations/_emerging_issues_operations.py | 238 -- .../operations/_events_operations.py | 328 --- .../v2018_07_01/operations/_operations.py | 127 - .../v2018_07_01/operations/_patch.py | 20 - .../mgmt/resourcehealth/v2018_07_01/py.typed | 1 - .../resourcehealth/v2022_10_01/__init__.py | 26 - .../v2022_10_01/_configuration.py | 66 - .../resourcehealth/v2022_10_01/_metadata.json | 119 - .../mgmt/resourcehealth/v2022_10_01/_patch.py | 20 - .../_resource_health_mgmt_client.py | 146 -- .../resourcehealth/v2022_10_01/_vendor.py | 16 - .../resourcehealth/v2022_10_01/_version.py | 9 - .../v2022_10_01/aio/__init__.py | 23 - .../v2022_10_01/aio/_configuration.py | 66 - .../resourcehealth/v2022_10_01/aio/_patch.py | 20 - .../aio/_resource_health_mgmt_client.py | 146 -- .../aio/operations/_metadata_operations.py | 192 -- .../v2022_10_01/aio/operations/_operations.py | 105 - .../v2022_10_01/aio/operations/_patch.py | 20 - .../v2022_10_01/models/__init__.py | 125 - .../v2022_10_01/models/_models_py3.py | 2140 ----------------- .../v2022_10_01/models/_patch.py | 20 - .../_resource_health_mgmt_client_enums.py | 121 - .../operations/_child_resources_operations.py | 186 -- .../operations/_metadata_operations.py | 237 -- .../v2022_10_01/operations/_operations.py | 127 - .../v2022_10_01/operations/_patch.py | 20 - .../mgmt/resourcehealth/v2022_10_01/py.typed | 1 - .../v2023_10_01_preview/__init__.py | 26 - .../v2023_10_01_preview/_configuration.py | 66 - .../v2023_10_01_preview/_metadata.json | 119 - .../v2023_10_01_preview/_patch.py | 20 - .../_resource_health_mgmt_client.py | 154 -- .../v2023_10_01_preview/_vendor.py | 16 - .../v2023_10_01_preview/_version.py | 9 - .../v2023_10_01_preview/aio/__init__.py | 23 - .../v2023_10_01_preview/aio/_configuration.py | 66 - .../v2023_10_01_preview/aio/_patch.py | 20 - .../aio/_resource_health_mgmt_client.py | 155 -- .../aio/operations/__init__.py | 37 - .../_availability_statuses_operations.py | 434 ---- ..._child_availability_statuses_operations.py | 230 -- .../operations/_child_resources_operations.py | 155 -- .../operations/_emerging_issues_operations.py | 200 -- .../aio/operations/_event_operations.py | 333 --- .../aio/operations/_events_operations.py | 349 --- .../_impacted_resources_operations.py | 384 --- .../aio/operations/_metadata_operations.py | 196 -- .../aio/operations/_operations.py | 107 - .../aio/operations/_patch.py | 20 - ..._advisory_impacted_resources_operations.py | 250 -- .../v2023_10_01_preview/models/_patch.py | 20 - .../operations/__init__.py | 37 - .../_availability_statuses_operations.py | 564 ----- ..._child_availability_statuses_operations.py | 294 --- .../operations/_child_resources_operations.py | 188 -- .../operations/_emerging_issues_operations.py | 243 -- .../operations/_event_operations.py | 451 ---- .../operations/_events_operations.py | 431 ---- .../_impacted_resources_operations.py | 502 ---- .../operations/_metadata_operations.py | 241 -- .../operations/_operations.py | 129 - .../v2023_10_01_preview/operations/_patch.py | 20 - ..._advisory_impacted_resources_operations.py | 313 --- .../v2023_10_01_preview/py.typed | 1 - .../availability_status_get_by_resource.py | 3 +- .../availability_statuses_list.py | 3 +- ...ability_statuses_list_by_resource_group.py | 3 +- ...bility_statuses_list_by_subscription_id.py | 3 +- ...ild_availability_status_get_by_resource.py | 3 +- .../child_availability_statuses_list.py | 3 +- .../generated_samples/child_resources_list.py | 3 +- .../generated_samples/emerging_issues_get.py | 3 +- .../generated_samples/emerging_issues_list.py | 3 +- ...ails_by_subscription_id_and_tracking_id.py | 3 +- ...ch_details_by_tenant_id_and_tracking_id.py | 3 +- ..._get_by_subscription_id_and_tracking_id.py | 3 +- .../event_get_by_tenant_id_and_tracking_id.py | 3 +- .../events_list_by_single_resource.py | 3 +- .../events_list_by_subscription_id.py | 3 +- .../events_list_by_tenant_id.py | 3 +- .../impacted_resources_get.py | 3 +- .../impacted_resources_get_by_tenant_id.py | 3 +- ...ist_by_subscription_id_list_by_event_id.py | 3 +- ...rces_list_by_tenant_id_list_by_event_id.py | 3 +- .../generated_samples/metadata_get_entity.py | 3 +- .../generated_samples/metadata_list.py | 3 +- .../generated_samples/operations_list.py | 3 +- ...ist_by_subscription_id_list_by_event_id.py | 3 +- ...rces_list_by_tenant_id_list_by_event_id.py | 3 +- .../generated_tests/conftest.py | 35 + ...h_mgmt_availability_statuses_operations.py | 62 + ..._availability_statuses_operations_async.py | 63 + ..._child_availability_statuses_operations.py | 41 + ..._availability_statuses_operations_async.py | 42 + ..._health_mgmt_child_resources_operations.py | 30 + ...h_mgmt_child_resources_operations_async.py | 31 + ..._health_mgmt_emerging_issues_operations.py | 40 + ...h_mgmt_emerging_issues_operations_async.py | 41 + ...t_resource_health_mgmt_event_operations.py | 63 + ...urce_health_mgmt_event_operations_async.py | 64 + ..._resource_health_mgmt_events_operations.py | 50 + ...rce_health_mgmt_events_operations_async.py | 51 + ...alth_mgmt_impacted_resources_operations.py | 65 + ...gmt_impacted_resources_operations_async.py | 66 + ...esource_health_mgmt_metadata_operations.py | 40 + ...e_health_mgmt_metadata_operations_async.py | 41 + .../test_resource_health_mgmt_operations.py | 29 + ...t_resource_health_mgmt_operations_async.py | 30 + ..._advisory_impacted_resources_operations.py | 41 + ...ory_impacted_resources_operations_async.py | 42 + .../azure-mgmt-resourcehealth/setup.py | 12 +- 197 files changed, 2263 insertions(+), 20525 deletions(-) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2015_01_01 => }/_patch.py (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2015_01_01 => }/aio/_patch.py (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/aio/operations/__init__.py (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/aio/operations/_availability_statuses_operations.py (80%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/aio/operations/_child_availability_statuses_operations.py (81%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/aio/operations/_child_resources_operations.py (82%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/aio/operations/_emerging_issues_operations.py (76%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/aio/operations/_event_operations.py (73%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/aio/operations/_events_operations.py (79%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/aio/operations/_impacted_resources_operations.py (77%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2018_07_01 => }/aio/operations/_metadata_operations.py (77%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2018_07_01 => }/aio/operations/_operations.py (75%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2015_01_01 => }/aio/operations/_patch.py (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/aio/operations/_security_advisory_impacted_resources_operations.py (78%) delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models.py rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2023_10_01_preview => }/models/__init__.py (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2023_10_01_preview => }/models/_models_py3.py (88%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2015_01_01 => }/models/_patch.py (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2023_10_01_preview => }/models/_resource_health_mgmt_client_enums.py (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/operations/__init__.py (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/operations/_availability_statuses_operations.py (83%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/operations/_child_availability_statuses_operations.py (83%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2015_01_01 => }/operations/_child_resources_operations.py (83%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/operations/_emerging_issues_operations.py (78%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/operations/_event_operations.py (77%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/operations/_events_operations.py (83%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/operations/_impacted_resources_operations.py (80%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2018_07_01 => }/operations/_metadata_operations.py (79%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2015_01_01 => }/operations/_operations.py (77%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2015_01_01 => }/operations/_patch.py (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{v2022_10_01 => }/operations/_security_advisory_impacted_resources_operations.py (80%) delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_resource_health_mgmt_client.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_vendor.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_resource_health_mgmt_client.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_resource_health_mgmt_client_enums.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/py.typed delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_resource_health_mgmt_client.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_vendor.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_resource_health_mgmt_client.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_resource_health_mgmt_client_enums.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/py.typed delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_configuration.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_metadata.json delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_resource_health_mgmt_client.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_vendor.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_version.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_configuration.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_resource_health_mgmt_client.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_metadata_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_models_py3.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_resource_health_mgmt_client_enums.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_resources_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_metadata_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/py.typed delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_configuration.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_metadata.json delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_resource_health_mgmt_client.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_vendor.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_version.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_configuration.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_resource_health_mgmt_client.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_child_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_child_resources_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_emerging_issues_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_event_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_events_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_impacted_resources_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_metadata_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_security_advisory_impacted_resources_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/__init__.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_child_availability_statuses_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_child_resources_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_emerging_issues_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_event_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_events_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_impacted_resources_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_metadata_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_patch.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_security_advisory_impacted_resources_operations.py delete mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/py.typed create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/conftest.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_availability_statuses_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_availability_statuses_operations_async.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_availability_statuses_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_availability_statuses_operations_async.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_resources_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_resources_operations_async.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_emerging_issues_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_emerging_issues_operations_async.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_event_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_event_operations_async.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_events_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_events_operations_async.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_impacted_resources_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_impacted_resources_operations_async.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_metadata_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_metadata_operations_async.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_operations_async.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_security_advisory_impacted_resources_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_security_advisory_impacted_resources_operations_async.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md b/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md index 994bb1f159b6..b39a6e30a1a5 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.0.0(it should be perview) (2024-10-30) + + + ## 1.0.0b5 (2023-10-23) ### Features Added diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/README.md b/sdk/resourcehealth/azure-mgmt-resourcehealth/README.md index 555b031e1fde..9676663cb110 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/README.md +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Resource Health Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json index 4c57736bae26..4a30a4030ee3 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json @@ -1,12 +1,12 @@ { - "commit": "9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0", + "commit": "ff1e3a1d1aa5f6a959bf4a214e6f69c4d1057647", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.19.0", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/resourcehealth/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/resourcehealth/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-preview-2023-10 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/resourcehealth/resource-manager/readme.md", "package-preview-2023-10": "2023-10-09 01:38:27 -0700 d9f13b4f513be56ca9bb14e97f8a699ac9a5a1cc Microsoft.ResourceHealth/preview/2023-10-01-preview/ResourceHealth.json", "package-2022-10": "2023-03-30 22:08:54 -0700 635b756c218c138de49cf3f4a3204e75630fc300 Microsoft.ResourceHealth/stable/2022-10-01/ResourceHealth.json", diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/__init__.py index 4bc541b954c5..f1e7a4fdd09e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/__init__.py @@ -7,14 +7,20 @@ # -------------------------------------------------------------------------- from ._resource_health_mgmt_client import ResourceHealthMgmtClient -__all__ = ['ResourceHealthMgmtClient'] +from ._version import VERSION + +__version__ = VERSION try: - from ._patch import patch_sdk # type: ignore - patch_sdk() + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: - pass + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk -from ._version import VERSION +__all__ = [ + "ResourceHealthMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) -__version__ = VERSION +_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py index 773401cc549a..ecd6bbbf3f11 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py @@ -1,16 +1,13 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- + from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -20,7 +17,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ResourceHealthMgmtClientConfiguration(Configuration): + +class ResourceHealthMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ResourceHealthMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -30,38 +28,38 @@ class ResourceHealthMgmtClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ): + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-resourcehealth/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ): - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_patch.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_patch.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_patch.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_resource_health_mgmt_client.py index 458500607467..557d755525c9 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_resource_health_mgmt_client.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_resource_health_mgmt_client.py @@ -1,312 +1,160 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from . import models as _models from ._configuration import ResourceHealthMgmtClientConfiguration from ._serialization import Deserializer, Serializer +from .operations import ( + AvailabilityStatusesOperations, + ChildAvailabilityStatusesOperations, + ChildResourcesOperations, + EmergingIssuesOperations, + EventOperations, + EventsOperations, + ImpactedResourcesOperations, + MetadataOperations, + Operations, + SecurityAdvisoryImpactedResourcesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class _SDKClient(object): - def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." - Will be removed in final version of multiapi azure-core based client - """ - pass -class ResourceHealthMgmtClient(MultiApiClientMixin, _SDKClient): +class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Resource Health Client. - This ready contains multiple API versions, to help you deal with all of the Azure clouds - (Azure Stack, Azure Government, Azure China, etc.). - By default, it uses the latest API version available on public Azure. - For production, you should stick to a particular api-version and/or profile. - The profile sets a mapping between an operation group and its API version. - The api-version parameter sets the default API version if the operation - group is not described in the profile. - + :ivar availability_statuses: AvailabilityStatusesOperations operations + :vartype availability_statuses: + azure.mgmt.resourcehealth.operations.AvailabilityStatusesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resourcehealth.operations.Operations + :ivar metadata: MetadataOperations operations + :vartype metadata: azure.mgmt.resourcehealth.operations.MetadataOperations + :ivar impacted_resources: ImpactedResourcesOperations operations + :vartype impacted_resources: azure.mgmt.resourcehealth.operations.ImpactedResourcesOperations + :ivar security_advisory_impacted_resources: SecurityAdvisoryImpactedResourcesOperations + operations + :vartype security_advisory_impacted_resources: + azure.mgmt.resourcehealth.operations.SecurityAdvisoryImpactedResourcesOperations + :ivar events: EventsOperations operations + :vartype events: azure.mgmt.resourcehealth.operations.EventsOperations + :ivar event: EventOperations operations + :vartype event: azure.mgmt.resourcehealth.operations.EventOperations + :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations + :vartype child_availability_statuses: + azure.mgmt.resourcehealth.operations.ChildAvailabilityStatusesOperations + :ivar child_resources: ChildResourcesOperations operations + :vartype child_resources: azure.mgmt.resourcehealth.operations.ChildResourcesOperations + :ivar emerging_issues: EmergingIssuesOperations operations + :vartype emerging_issues: azure.mgmt.resourcehealth.operations.EmergingIssuesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param api_version: API version to use if no profile is provided, or if missing in profile. - :type api_version: str - :param base_url: Service URL + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :param profile: A profile definition, from KnownProfiles to dict. - :type profile: azure.profiles.KnownProfiles + :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ - DEFAULT_API_VERSION = '2022-10-01' - _PROFILE_TAG = "azure.mgmt.resourcehealth.ResourceHealthMgmtClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile: KnownProfiles=KnownProfiles.default, **kwargs: Any - ): - if api_version: - kwargs.setdefault('api_version', api_version) - self._config = ResourceHealthMgmtClientConfiguration(credential, subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - super(ResourceHealthMgmtClient, self).__init__( - api_version=api_version, - profile=profile + ) -> None: + self._config = ResourceHealthMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.availability_statuses = AvailabilityStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize) + self.impacted_resources = ImpactedResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.security_advisory_impacted_resources = SecurityAdvisoryImpactedResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize) + self.event = EventOperations(self._client, self._config, self._serialize, self._deserialize) + self.child_availability_statuses = ChildAvailabilityStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.child_resources = ChildResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.emerging_issues = EmergingIssuesOperations(self._client, self._config, self._serialize, self._deserialize) - @classmethod - def _models_dict(cls, api_version): - return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} - - @classmethod - def models(cls, api_version=DEFAULT_API_VERSION): - """Module depends on the API version: - - * 2015-01-01: :mod:`v2015_01_01.models` - * 2018-07-01: :mod:`v2018_07_01.models` - * 2022-10-01: :mod:`v2022_10_01.models` - * 2023-10-01-preview: :mod:`v2023_10_01_preview.models` - """ - if api_version == '2015-01-01': - from .v2015_01_01 import models - return models - elif api_version == '2018-07-01': - from .v2018_07_01 import models - return models - elif api_version == '2022-10-01': - from .v2022_10_01 import models - return models - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview import models - return models - raise ValueError("API version {} is not available".format(api_version)) - - @property - def availability_statuses(self): - """Instance depends on the API version: - - * 2015-01-01: :class:`AvailabilityStatusesOperations` - * 2018-07-01: :class:`AvailabilityStatusesOperations` - * 2022-10-01: :class:`AvailabilityStatusesOperations` - * 2023-10-01-preview: :class:`AvailabilityStatusesOperations` - """ - api_version = self._get_api_version('availability_statuses') - if api_version == '2015-01-01': - from .v2015_01_01.operations import AvailabilityStatusesOperations as OperationClass - elif api_version == '2018-07-01': - from .v2018_07_01.operations import AvailabilityStatusesOperations as OperationClass - elif api_version == '2022-10-01': - from .v2022_10_01.operations import AvailabilityStatusesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import AvailabilityStatusesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'availability_statuses'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def child_availability_statuses(self): - """Instance depends on the API version: - - * 2015-01-01: :class:`ChildAvailabilityStatusesOperations` - * 2022-10-01: :class:`ChildAvailabilityStatusesOperations` - * 2023-10-01-preview: :class:`ChildAvailabilityStatusesOperations` - """ - api_version = self._get_api_version('child_availability_statuses') - if api_version == '2015-01-01': - from .v2015_01_01.operations import ChildAvailabilityStatusesOperations as OperationClass - elif api_version == '2022-10-01': - from .v2022_10_01.operations import ChildAvailabilityStatusesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import ChildAvailabilityStatusesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'child_availability_statuses'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def child_resources(self): - """Instance depends on the API version: - - * 2015-01-01: :class:`ChildResourcesOperations` - * 2022-10-01: :class:`ChildResourcesOperations` - * 2023-10-01-preview: :class:`ChildResourcesOperations` - """ - api_version = self._get_api_version('child_resources') - if api_version == '2015-01-01': - from .v2015_01_01.operations import ChildResourcesOperations as OperationClass - elif api_version == '2022-10-01': - from .v2022_10_01.operations import ChildResourcesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import ChildResourcesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'child_resources'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def emerging_issues(self): - """Instance depends on the API version: - - * 2018-07-01: :class:`EmergingIssuesOperations` - * 2022-10-01: :class:`EmergingIssuesOperations` - * 2023-10-01-preview: :class:`EmergingIssuesOperations` - """ - api_version = self._get_api_version('emerging_issues') - if api_version == '2018-07-01': - from .v2018_07_01.operations import EmergingIssuesOperations as OperationClass - elif api_version == '2022-10-01': - from .v2022_10_01.operations import EmergingIssuesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import EmergingIssuesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'emerging_issues'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def event(self): - """Instance depends on the API version: - - * 2022-10-01: :class:`EventOperations` - * 2023-10-01-preview: :class:`EventOperations` - """ - api_version = self._get_api_version('event') - if api_version == '2022-10-01': - from .v2022_10_01.operations import EventOperations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import EventOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'event'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def events(self): - """Instance depends on the API version: - - * 2018-07-01: :class:`EventsOperations` - * 2022-10-01: :class:`EventsOperations` - * 2023-10-01-preview: :class:`EventsOperations` - """ - api_version = self._get_api_version('events') - if api_version == '2018-07-01': - from .v2018_07_01.operations import EventsOperations as OperationClass - elif api_version == '2022-10-01': - from .v2022_10_01.operations import EventsOperations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import EventsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'events'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def impacted_resources(self): - """Instance depends on the API version: - - * 2022-10-01: :class:`ImpactedResourcesOperations` - * 2023-10-01-preview: :class:`ImpactedResourcesOperations` - """ - api_version = self._get_api_version('impacted_resources') - if api_version == '2022-10-01': - from .v2022_10_01.operations import ImpactedResourcesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import ImpactedResourcesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'impacted_resources'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def metadata(self): - """Instance depends on the API version: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. - * 2018-07-01: :class:`MetadataOperations` - * 2022-10-01: :class:`MetadataOperations` - * 2023-10-01-preview: :class:`MetadataOperations` - """ - api_version = self._get_api_version('metadata') - if api_version == '2018-07-01': - from .v2018_07_01.operations import MetadataOperations as OperationClass - elif api_version == '2022-10-01': - from .v2022_10_01.operations import MetadataOperations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import MetadataOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'metadata'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + - @property - def operations(self): - """Instance depends on the API version: + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - * 2015-01-01: :class:`Operations` - * 2018-07-01: :class:`Operations` - * 2022-10-01: :class:`Operations` - * 2023-10-01-preview: :class:`Operations` + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse """ - api_version = self._get_api_version('operations') - if api_version == '2015-01-01': - from .v2015_01_01.operations import Operations as OperationClass - elif api_version == '2018-07-01': - from .v2018_07_01.operations import Operations as OperationClass - elif api_version == '2022-10-01': - from .v2022_10_01.operations import Operations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import Operations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - @property - def security_advisory_impacted_resources(self): - """Instance depends on the API version: + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - * 2022-10-01: :class:`SecurityAdvisoryImpactedResourcesOperations` - * 2023-10-01-preview: :class:`SecurityAdvisoryImpactedResourcesOperations` - """ - api_version = self._get_api_version('security_advisory_impacted_resources') - if api_version == '2022-10-01': - from .v2022_10_01.operations import SecurityAdvisoryImpactedResourcesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from .v2023_10_01_preview.operations import SecurityAdvisoryImpactedResourcesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_advisory_impacted_resources'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - def close(self): + def close(self) -> None: self._client.close() - def __enter__(self): + + def __enter__(self) -> Self: self._client.__enter__() return self - def __exit__(self, *exc_details): + + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py index a00658b1fc19..8139854b97bb 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +290,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +335,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,14 +346,12 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[ - [str, Dict[str, Any], Any], Any - ] = attribute_transformer, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -392,7 +385,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -417,7 +410,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -447,7 +440,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -547,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -563,7 +556,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -651,7 +644,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -670,7 +663,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -712,7 +705,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -732,6 +725,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -746,7 +740,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -754,8 +748,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - do_quote = not kwargs.get('skip_quote', False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -806,7 +800,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -826,7 +820,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -913,12 +907,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): raise serialized.append(None) - if kwargs.get('do_quote', False): - serialized = [ - '' if s is None else quote(str(s), safe='') - for s - in serialized - ] + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] if div: serialized = ["" if s is None else str(s) for s in serialized] @@ -999,7 +989,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1176,10 +1166,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1215,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1236,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1377,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1397,7 +1385,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1450,12 +1438,12 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1487,7 +1475,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1521,14 +1509,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1584,7 +1572,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1658,7 +1646,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1706,7 +1694,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1763,7 +1751,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1814,7 +1802,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1868,10 +1855,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1899,7 +1886,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1916,7 +1903,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1951,7 +1938,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1988,7 +1975,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -2004,9 +1991,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py index 9ed953daa8fe..9bd4c9b55137 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py @@ -1,8 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b5" +VERSION = "0.0.0" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/__init__.py index 63b4f89523db..d95ad182aa0f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/__init__.py @@ -7,4 +7,17 @@ # -------------------------------------------------------------------------- from ._resource_health_mgmt_client import ResourceHealthMgmtClient -__all__ = ['ResourceHealthMgmtClient'] + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ResourceHealthMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py index 2db2b6990c92..4e187b6f9751 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py @@ -1,16 +1,13 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- + from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -20,7 +17,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ResourceHealthMgmtClientConfiguration(Configuration): + +class ResourceHealthMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ResourceHealthMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -30,38 +28,38 @@ class ResourceHealthMgmtClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-resourcehealth/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_patch.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_patch.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_patch.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_resource_health_mgmt_client.py index a6a218416f71..486764f56be5 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_resource_health_mgmt_client.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_resource_health_mgmt_client.py @@ -1,312 +1,163 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import ResourceHealthMgmtClientConfiguration +from .operations import ( + AvailabilityStatusesOperations, + ChildAvailabilityStatusesOperations, + ChildResourcesOperations, + EmergingIssuesOperations, + EventOperations, + EventsOperations, + ImpactedResourcesOperations, + MetadataOperations, + Operations, + SecurityAdvisoryImpactedResourcesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class _SDKClient(object): - def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." - Will be removed in final version of multiapi azure-core based client - """ - pass -class ResourceHealthMgmtClient(MultiApiClientMixin, _SDKClient): +class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Resource Health Client. - This ready contains multiple API versions, to help you deal with all of the Azure clouds - (Azure Stack, Azure Government, Azure China, etc.). - By default, it uses the latest API version available on public Azure. - For production, you should stick to a particular api-version and/or profile. - The profile sets a mapping between an operation group and its API version. - The api-version parameter sets the default API version if the operation - group is not described in the profile. - + :ivar availability_statuses: AvailabilityStatusesOperations operations + :vartype availability_statuses: + azure.mgmt.resourcehealth.aio.operations.AvailabilityStatusesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resourcehealth.aio.operations.Operations + :ivar metadata: MetadataOperations operations + :vartype metadata: azure.mgmt.resourcehealth.aio.operations.MetadataOperations + :ivar impacted_resources: ImpactedResourcesOperations operations + :vartype impacted_resources: + azure.mgmt.resourcehealth.aio.operations.ImpactedResourcesOperations + :ivar security_advisory_impacted_resources: SecurityAdvisoryImpactedResourcesOperations + operations + :vartype security_advisory_impacted_resources: + azure.mgmt.resourcehealth.aio.operations.SecurityAdvisoryImpactedResourcesOperations + :ivar events: EventsOperations operations + :vartype events: azure.mgmt.resourcehealth.aio.operations.EventsOperations + :ivar event: EventOperations operations + :vartype event: azure.mgmt.resourcehealth.aio.operations.EventOperations + :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations + :vartype child_availability_statuses: + azure.mgmt.resourcehealth.aio.operations.ChildAvailabilityStatusesOperations + :ivar child_resources: ChildResourcesOperations operations + :vartype child_resources: azure.mgmt.resourcehealth.aio.operations.ChildResourcesOperations + :ivar emerging_issues: EmergingIssuesOperations operations + :vartype emerging_issues: azure.mgmt.resourcehealth.aio.operations.EmergingIssuesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param api_version: API version to use if no profile is provided, or if missing in profile. - :type api_version: str - :param base_url: Service URL + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :param profile: A profile definition, from KnownProfiles to dict. - :type profile: azure.profiles.KnownProfiles + :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ - DEFAULT_API_VERSION = '2022-10-01' - _PROFILE_TAG = "azure.mgmt.resourcehealth.ResourceHealthMgmtClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - api_version: Optional[str] = None, base_url: str = "https://management.azure.com", - profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: - if api_version: - kwargs.setdefault('api_version', api_version) - self._config = ResourceHealthMgmtClientConfiguration(credential, subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - super(ResourceHealthMgmtClient, self).__init__( - api_version=api_version, - profile=profile + self._config = ResourceHealthMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs ) - - @classmethod - def _models_dict(cls, api_version): - return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} - - @classmethod - def models(cls, api_version=DEFAULT_API_VERSION): - """Module depends on the API version: - - * 2015-01-01: :mod:`v2015_01_01.models` - * 2018-07-01: :mod:`v2018_07_01.models` - * 2022-10-01: :mod:`v2022_10_01.models` - * 2023-10-01-preview: :mod:`v2023_10_01_preview.models` - """ - if api_version == '2015-01-01': - from ..v2015_01_01 import models - return models - elif api_version == '2018-07-01': - from ..v2018_07_01 import models - return models - elif api_version == '2022-10-01': - from ..v2022_10_01 import models - return models - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview import models - return models - raise ValueError("API version {} is not available".format(api_version)) - - @property - def availability_statuses(self): - """Instance depends on the API version: - - * 2015-01-01: :class:`AvailabilityStatusesOperations` - * 2018-07-01: :class:`AvailabilityStatusesOperations` - * 2022-10-01: :class:`AvailabilityStatusesOperations` - * 2023-10-01-preview: :class:`AvailabilityStatusesOperations` - """ - api_version = self._get_api_version('availability_statuses') - if api_version == '2015-01-01': - from ..v2015_01_01.aio.operations import AvailabilityStatusesOperations as OperationClass - elif api_version == '2018-07-01': - from ..v2018_07_01.aio.operations import AvailabilityStatusesOperations as OperationClass - elif api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import AvailabilityStatusesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import AvailabilityStatusesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'availability_statuses'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def child_availability_statuses(self): - """Instance depends on the API version: - - * 2015-01-01: :class:`ChildAvailabilityStatusesOperations` - * 2022-10-01: :class:`ChildAvailabilityStatusesOperations` - * 2023-10-01-preview: :class:`ChildAvailabilityStatusesOperations` - """ - api_version = self._get_api_version('child_availability_statuses') - if api_version == '2015-01-01': - from ..v2015_01_01.aio.operations import ChildAvailabilityStatusesOperations as OperationClass - elif api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import ChildAvailabilityStatusesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import ChildAvailabilityStatusesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'child_availability_statuses'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def child_resources(self): - """Instance depends on the API version: - - * 2015-01-01: :class:`ChildResourcesOperations` - * 2022-10-01: :class:`ChildResourcesOperations` - * 2023-10-01-preview: :class:`ChildResourcesOperations` - """ - api_version = self._get_api_version('child_resources') - if api_version == '2015-01-01': - from ..v2015_01_01.aio.operations import ChildResourcesOperations as OperationClass - elif api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import ChildResourcesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import ChildResourcesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'child_resources'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def emerging_issues(self): - """Instance depends on the API version: - - * 2018-07-01: :class:`EmergingIssuesOperations` - * 2022-10-01: :class:`EmergingIssuesOperations` - * 2023-10-01-preview: :class:`EmergingIssuesOperations` - """ - api_version = self._get_api_version('emerging_issues') - if api_version == '2018-07-01': - from ..v2018_07_01.aio.operations import EmergingIssuesOperations as OperationClass - elif api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import EmergingIssuesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import EmergingIssuesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'emerging_issues'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def event(self): - """Instance depends on the API version: - - * 2022-10-01: :class:`EventOperations` - * 2023-10-01-preview: :class:`EventOperations` - """ - api_version = self._get_api_version('event') - if api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import EventOperations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import EventOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'event'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def events(self): - """Instance depends on the API version: - - * 2018-07-01: :class:`EventsOperations` - * 2022-10-01: :class:`EventsOperations` - * 2023-10-01-preview: :class:`EventsOperations` - """ - api_version = self._get_api_version('events') - if api_version == '2018-07-01': - from ..v2018_07_01.aio.operations import EventsOperations as OperationClass - elif api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import EventsOperations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import EventsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'events'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def impacted_resources(self): - """Instance depends on the API version: - - * 2022-10-01: :class:`ImpactedResourcesOperations` - * 2023-10-01-preview: :class:`ImpactedResourcesOperations` - """ - api_version = self._get_api_version('impacted_resources') - if api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import ImpactedResourcesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import ImpactedResourcesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'impacted_resources'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def metadata(self): - """Instance depends on the API version: - - * 2018-07-01: :class:`MetadataOperations` - * 2022-10-01: :class:`MetadataOperations` - * 2023-10-01-preview: :class:`MetadataOperations` - """ - api_version = self._get_api_version('metadata') - if api_version == '2018-07-01': - from ..v2018_07_01.aio.operations import MetadataOperations as OperationClass - elif api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import MetadataOperations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import MetadataOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'metadata'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def operations(self): - """Instance depends on the API version: - - * 2015-01-01: :class:`Operations` - * 2018-07-01: :class:`Operations` - * 2022-10-01: :class:`Operations` - * 2023-10-01-preview: :class:`Operations` + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.availability_statuses = AvailabilityStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize) + self.impacted_resources = ImpactedResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.security_advisory_impacted_resources = SecurityAdvisoryImpactedResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize) + self.event = EventOperations(self._client, self._config, self._serialize, self._deserialize) + self.child_availability_statuses = ChildAvailabilityStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.child_resources = ChildResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.emerging_issues = EmergingIssuesOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse """ - api_version = self._get_api_version('operations') - if api_version == '2015-01-01': - from ..v2015_01_01.aio.operations import Operations as OperationClass - elif api_version == '2018-07-01': - from ..v2018_07_01.aio.operations import Operations as OperationClass - elif api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import Operations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import Operations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def security_advisory_impacted_resources(self): - """Instance depends on the API version: - * 2022-10-01: :class:`SecurityAdvisoryImpactedResourcesOperations` - * 2023-10-01-preview: :class:`SecurityAdvisoryImpactedResourcesOperations` - """ - api_version = self._get_api_version('security_advisory_impacted_resources') - if api_version == '2022-10-01': - from ..v2022_10_01.aio.operations import SecurityAdvisoryImpactedResourcesOperations as OperationClass - elif api_version == '2023-10-01-preview': - from ..v2023_10_01_preview.aio.operations import SecurityAdvisoryImpactedResourcesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_advisory_impacted_resources'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - async def close(self): + async def close(self) -> None: await self._client.close() - async def __aenter__(self): + + async def __aenter__(self) -> Self: await self._client.__aenter__() return self - async def __aexit__(self, *exc_details): + + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/__init__.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/__init__.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/__init__.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_availability_statuses_operations.py similarity index 80% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_availability_statuses_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_availability_statuses_operations.py index 995adf31f2a1..a5002064023b 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_availability_statuses_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._availability_statuses_operations import ( build_get_by_resource_request, build_list_by_resource_group_request, @@ -35,6 +34,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +48,7 @@ class AvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`availability_statuses` attribute. """ @@ -57,7 +60,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription_id( @@ -72,19 +74,18 @@ def list_by_subscription_id( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,17 +96,15 @@ def list_by_subscription_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_id_request( + _request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, filter=filter, expand=expand, api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -117,13 +116,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -133,11 +131,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,10 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any @@ -170,19 +164,18 @@ def list_by_resource_group( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,18 +186,16 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, filter=filter, expand=expand, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -216,13 +207,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -232,11 +222,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -249,10 +239,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - @distributed_trace_async async def get_by_resource( self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any @@ -273,12 +259,11 @@ async def get_by_resource( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus + :rtype: ~azure.mgmt.resourcehealth.models.AvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,24 +274,22 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - request = build_get_by_resource_request( + _request = build_get_by_resource_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.get_by_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,14 +299,12 @@ async def get_by_resource( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) + deserialized = self._deserialize("AvailabilityStatus", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} + return deserialized # type: ignore @distributed_trace def list( @@ -345,19 +326,18 @@ def list( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,17 +348,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -390,13 +368,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -406,11 +383,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -422,5 +399,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_child_availability_statuses_operations.py similarity index 81% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_availability_statuses_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_child_availability_statuses_operations.py index dc9c59d60e57..94329f56de02 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_child_availability_statuses_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._child_availability_statuses_operations import build_get_by_resource_request, build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ class ChildAvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`child_availability_statuses` attribute. """ @@ -52,7 +55,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get_by_resource( @@ -72,12 +74,11 @@ async def get_by_resource( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus + :rtype: ~azure.mgmt.resourcehealth.models.AvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,24 +89,22 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - request = build_get_by_resource_request( + _request = build_get_by_resource_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.get_by_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -115,16 +114,12 @@ async def get_by_resource( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) + deserialized = self._deserialize("AvailabilityStatus", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_resource.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" - } + return deserialized # type: ignore @distributed_trace def list( @@ -145,19 +140,18 @@ def list( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,17 +162,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -190,13 +182,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -206,11 +197,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,5 +213,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_child_resources_operations.py similarity index 82% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_resources_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_child_resources_operations.py index 42043104d28b..f07e10757628 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_child_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._child_resources_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +42,7 @@ class ChildResourcesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`child_resources` attribute. """ @@ -51,7 +54,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -72,19 +74,18 @@ def list( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,17 +96,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -117,13 +116,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -133,11 +131,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,5 +147,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_emerging_issues_operations.py similarity index 76% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_emerging_issues_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_emerging_issues_operations.py index 4ebb1a5c9670..5a2bf5aa1cdf 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_emerging_issues_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_emerging_issues_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._emerging_issues_operations import build_get_request, build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ class EmergingIssuesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`emerging_issues` attribute. """ @@ -52,26 +55,24 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult"]: """Lists Azure services' emerging issues. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EmergingIssuesGetResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.EmergingIssuesGetResult] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult" def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -101,13 +100,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("EmergingIssueListResult", pipeline_response) @@ -117,11 +115,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -134,8 +132,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} - @distributed_trace_async async def get( self, issue_name: Union[str, _models.IssueNameParameter], **kwargs: Any @@ -143,13 +139,12 @@ async def get( """Gets Azure services' emerging issues. :param issue_name: The name of the emerging issue. "default" Required. - :type issue_name: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.IssueNameParameter - :keyword callable cls: A custom type or function that will be passed the direct response + :type issue_name: str or ~azure.mgmt.resourcehealth.models.IssueNameParameter :return: EmergingIssuesGetResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult + :rtype: ~azure.mgmt.resourcehealth.models.EmergingIssuesGetResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,22 +155,20 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( issue_name=issue_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,11 +178,9 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response) + deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_event_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_event_operations.py similarity index 73% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_event_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_event_operations.py index 12fc545630a9..0194ec537e98 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_event_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_event_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._event_operations import ( build_fetch_details_by_subscription_id_and_tracking_id_request, build_fetch_details_by_tenant_id_and_tracking_id_request, @@ -32,6 +31,10 @@ build_get_by_tenant_id_and_tracking_id_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +45,7 @@ class EventOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`event` attribute. """ @@ -54,7 +57,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get_by_subscription_id_and_tracking_id( @@ -76,12 +78,11 @@ async def get_by_subscription_id_and_tracking_id( property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default value is None. :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :rtype: ~azure.mgmt.resourcehealth.models.Event :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,25 +93,23 @@ async def get_by_subscription_id_and_tracking_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Event] = kwargs.pop("cls", None) - request = build_get_by_subscription_id_and_tracking_id_request( + _request = build_get_by_subscription_id_and_tracking_id_request( event_tracking_id=event_tracking_id, subscription_id=self._config.subscription_id, filter=filter, query_start_time=query_start_time, api_version=api_version, - template_url=self.get_by_subscription_id_and_tracking_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -120,19 +119,15 @@ async def get_by_subscription_id_and_tracking_id( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Event", pipeline_response) + deserialized = self._deserialize("Event", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_subscription_id_and_tracking_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" - } + return deserialized # type: ignore @distributed_trace_async - async def fetch_details_by_subscription_id_and_tracking_id( + async def fetch_details_by_subscription_id_and_tracking_id( # pylint: disable=name-too-long self, event_tracking_id: str, **kwargs: Any ) -> _models.Event: """Service health event details in the subscription by event tracking id. This can be used to @@ -140,12 +135,11 @@ async def fetch_details_by_subscription_id_and_tracking_id( :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. :type event_tracking_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :rtype: ~azure.mgmt.resourcehealth.models.Event :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -156,23 +150,21 @@ async def fetch_details_by_subscription_id_and_tracking_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Event] = kwargs.pop("cls", None) - request = build_fetch_details_by_subscription_id_and_tracking_id_request( + _request = build_fetch_details_by_subscription_id_and_tracking_id_request( event_tracking_id=event_tracking_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.fetch_details_by_subscription_id_and_tracking_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,16 +174,12 @@ async def fetch_details_by_subscription_id_and_tracking_id( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Event", pipeline_response) + deserialized = self._deserialize("Event", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - fetch_details_by_subscription_id_and_tracking_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" - } + return deserialized # type: ignore @distributed_trace_async async def get_by_tenant_id_and_tracking_id( @@ -213,12 +201,11 @@ async def get_by_tenant_id_and_tracking_id( property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default value is None. :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :rtype: ~azure.mgmt.resourcehealth.models.Event :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -229,24 +216,22 @@ async def get_by_tenant_id_and_tracking_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Event] = kwargs.pop("cls", None) - request = build_get_by_tenant_id_and_tracking_id_request( + _request = build_get_by_tenant_id_and_tracking_id_request( event_tracking_id=event_tracking_id, filter=filter, query_start_time=query_start_time, api_version=api_version, - template_url=self.get_by_tenant_id_and_tracking_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -256,28 +241,27 @@ async def get_by_tenant_id_and_tracking_id( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Event", pipeline_response) + deserialized = self._deserialize("Event", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_tenant_id_and_tracking_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"} + return deserialized # type: ignore @distributed_trace_async - async def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: str, **kwargs: Any) -> _models.Event: + async def fetch_details_by_tenant_id_and_tracking_id( # pylint: disable=name-too-long + self, event_tracking_id: str, **kwargs: Any + ) -> _models.Event: """Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events. :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. :type event_tracking_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :rtype: ~azure.mgmt.resourcehealth.models.Event :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,22 +272,20 @@ async def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Event] = kwargs.pop("cls", None) - request = build_fetch_details_by_tenant_id_and_tracking_id_request( + _request = build_fetch_details_by_tenant_id_and_tracking_id_request( event_tracking_id=event_tracking_id, api_version=api_version, - template_url=self.fetch_details_by_tenant_id_and_tracking_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,13 +295,9 @@ async def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: st error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Event", pipeline_response) + deserialized = self._deserialize("Event", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - fetch_details_by_tenant_id_and_tracking_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" - } + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_events_operations.py similarity index 79% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_events_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_events_operations.py index 19b29bfa3610..4945583a73a3 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_events_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_events_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,20 +20,22 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._events_operations import ( build_list_by_single_resource_request, build_list_by_subscription_id_request, build_list_by_tenant_id_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ class EventsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`events` attribute. """ @@ -55,7 +58,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription_id( @@ -71,19 +73,17 @@ def list_by_subscription_id( property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default value is None. :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.Event] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Events] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,17 +94,15 @@ def list_by_subscription_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_id_request( + _request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, filter=filter, query_start_time=query_start_time, api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -116,13 +114,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) @@ -132,11 +129,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,10 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" - } - @distributed_trace def list_by_tenant_id( self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any @@ -167,19 +160,17 @@ def list_by_tenant_id( property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default value is None. :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.Event] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Events] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,16 +181,14 @@ def list_by_tenant_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tenant_id_request( + _request = build_list_by_tenant_id_request( filter=filter, query_start_time=query_start_time, api_version=api_version, - template_url=self.list_by_tenant_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -211,13 +200,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) @@ -227,11 +215,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -244,8 +232,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_tenant_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events"} - @distributed_trace def list_by_single_resource( self, resource_uri: str, filter: Optional[str] = None, **kwargs: Any @@ -263,19 +249,17 @@ def list_by_single_resource( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.Event] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Events] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -286,16 +270,14 @@ def list_by_single_resource( def prepare_request(next_link=None): if not next_link: - request = build_list_by_single_resource_request( + _request = build_list_by_single_resource_request( resource_uri=resource_uri, filter=filter, api_version=api_version, - template_url=self.list_by_single_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -307,13 +289,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) @@ -323,11 +304,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -339,5 +320,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_impacted_resources_operations.py similarity index 77% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_impacted_resources_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_impacted_resources_operations.py index 2a73eadb4660..3feec0b1eb5c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_impacted_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_impacted_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._impacted_resources_operations import ( build_get_by_tenant_id_request, build_get_request, @@ -35,6 +34,10 @@ build_list_by_tenant_id_and_event_id_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +48,7 @@ class ImpactedResourcesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`impacted_resources` attribute. """ @@ -57,7 +60,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription_id_and_event_id( @@ -71,20 +73,19 @@ def list_by_subscription_id_and_event_id( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventImpactedResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.EventImpactedResource] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,17 +96,15 @@ def list_by_subscription_id_and_event_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_id_and_event_id_request( + _request = build_list_by_subscription_id_and_event_id_request( event_tracking_id=event_tracking_id, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_subscription_id_and_event_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -117,13 +116,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) @@ -133,11 +131,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,10 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id_and_event_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" - } - @distributed_trace_async async def get( self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any @@ -164,12 +158,11 @@ async def get( :type event_tracking_id: str :param impacted_resource_name: Name of the Impacted Resource. Required. :type impacted_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EventImpactedResource or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource + :rtype: ~azure.mgmt.resourcehealth.models.EventImpactedResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,24 +173,22 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( event_tracking_id=event_tracking_id, impacted_resource_name=impacted_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,16 +198,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventImpactedResource", pipeline_response) + deserialized = self._deserialize("EventImpactedResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_tenant_id_and_event_id( @@ -230,20 +217,19 @@ def list_by_tenant_id_and_event_id( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventImpactedResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.EventImpactedResource] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,16 +240,14 @@ def list_by_tenant_id_and_event_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tenant_id_and_event_id_request( + _request = build_list_by_tenant_id_and_event_id_request( event_tracking_id=event_tracking_id, filter=filter, api_version=api_version, - template_url=self.list_by_tenant_id_and_event_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -275,13 +259,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) @@ -291,11 +274,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,10 +291,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_tenant_id_and_event_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" - } - @distributed_trace_async async def get_by_tenant_id( self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any @@ -322,12 +301,11 @@ async def get_by_tenant_id( :type event_tracking_id: str :param impacted_resource_name: Name of the Impacted Resource. Required. :type impacted_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EventImpactedResource or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource + :rtype: ~azure.mgmt.resourcehealth.models.EventImpactedResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -338,23 +316,21 @@ async def get_by_tenant_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) - request = build_get_by_tenant_id_request( + _request = build_get_by_tenant_id_request( event_tracking_id=event_tracking_id, impacted_resource_name=impacted_resource_name, api_version=api_version, - template_url=self.get_by_tenant_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,13 +340,9 @@ async def get_by_tenant_id( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventImpactedResource", pipeline_response) + deserialized = self._deserialize("EventImpactedResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_tenant_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" - } + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_metadata_operations.py similarity index 77% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_metadata_operations.py index f35e799c90f2..1e7eddffdb86 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_metadata_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._metadata_operations import build_get_entity_request, build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ class MetadataOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`metadata` attribute. """ @@ -52,25 +55,23 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.MetadataEntity"]: """Gets the list of metadata entities. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetadataEntity or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.MetadataEntity] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.MetadataEntity] :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._api_version or "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -81,14 +82,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.MetadataEntity"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -100,13 +99,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("MetadataEntityListResult", pipeline_response) @@ -116,11 +114,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,20 +131,17 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} - @distributed_trace_async async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: """Gets the list of metadata entities. :param name: Name of metadata entity. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MetadataEntity or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2018_07_01.models.MetadataEntity + :rtype: ~azure.mgmt.resourcehealth.models.MetadataEntity :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,22 +152,20 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) - request = build_get_entity_request( + _request = build_get_entity_request( name=name, api_version=api_version, - template_url=self.get_entity.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,11 +175,9 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MetadataEntity", pipeline_response) + deserialized = self._deserialize("MetadataEntity", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_operations.py similarity index 75% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_operations.py index 1cfa6b6927bc..30ae58a4f361 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +40,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`operations` attribute. """ @@ -49,18 +52,16 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list(self, **kwargs: Any) -> _models.OperationListResult: """Lists available operations for the resourcehealth resource provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2018_07_01.models.OperationListResult + :rtype: ~azure.mgmt.resourcehealth.models.OperationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -71,21 +72,19 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -95,11 +94,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_patch.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_patch.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_patch.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_security_advisory_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_security_advisory_impacted_resources_operations.py similarity index 78% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_security_advisory_impacted_resources_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_security_advisory_impacted_resources_operations.py index 0983cb5ceb1c..bdb68b4b1170 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_security_advisory_impacted_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/operations/_security_advisory_impacted_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,30 +20,32 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._security_advisory_impacted_resources_operations import ( build_list_by_subscription_id_and_event_id_request, build_list_by_tenant_id_and_event_id_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SecurityAdvisoryImpactedResourcesOperations: +class SecurityAdvisoryImpactedResourcesOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.aio.ResourceHealthMgmtClient`'s :attr:`security_advisory_impacted_resources` attribute. """ @@ -54,7 +57,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription_id_and_event_id( @@ -68,20 +70,19 @@ def list_by_subscription_id_and_event_id( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventImpactedResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.EventImpactedResource] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,17 +93,15 @@ def list_by_subscription_id_and_event_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_id_and_event_id_request( + _request = build_list_by_subscription_id_and_event_id_request( event_tracking_id=event_tracking_id, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_subscription_id_and_event_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -114,13 +113,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) @@ -130,11 +128,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,10 +145,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id_and_event_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" - } - @distributed_trace def list_by_tenant_id_and_event_id( self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any @@ -163,20 +157,19 @@ def list_by_tenant_id_and_event_id( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventImpactedResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.models.EventImpactedResource] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,16 +180,14 @@ def list_by_tenant_id_and_event_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tenant_id_and_event_id_request( + _request = build_list_by_tenant_id_and_event_id_request( event_tracking_id=event_tracking_id, filter=filter, api_version=api_version, - template_url=self.list_by_tenant_id_and_event_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -208,13 +199,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) @@ -224,11 +214,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +230,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_tenant_id_and_event_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" - } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models.py deleted file mode 100644 index 644705b14842..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models.py +++ /dev/null @@ -1,7 +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. -# -------------------------------------------------------------------------- -from .v2022_10_01.models import * diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models/__init__.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/__init__.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models/__init__.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/_models_py3.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models/_models_py3.py similarity index 88% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/_models_py3.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models/_models_py3.py index 7fdfec5e45c0..6f8b1460d212 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/_models_py3.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models/_models_py3.py @@ -11,7 +11,7 @@ import sys from typing import Any, List, Optional, TYPE_CHECKING, Union -from ... import _serialization +from .. import _serialization if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -36,8 +36,7 @@ class AvailabilityStatus(_serialization.Model): :ivar location: Azure Resource Manager geo location of the resource. :vartype location: str :ivar properties: Properties of availability state. - :vartype properties: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatusProperties + :vartype properties: ~azure.mgmt.resourcehealth.models.AvailabilityStatusProperties """ _attribute_map = { @@ -68,8 +67,7 @@ def __init__( :keyword location: Azure Resource Manager geo location of the resource. :paramtype location: str :keyword properties: Properties of availability state. - :paramtype properties: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatusProperties + :paramtype properties: ~azure.mgmt.resourcehealth.models.AvailabilityStatusProperties """ super().__init__(**kwargs) self.id = id @@ -82,10 +80,10 @@ def __init__( class AvailabilityStatusListResult(_serialization.Model): """The List availabilityStatus operation response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The list of availabilityStatuses. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] + :vartype value: list[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :ivar next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() with this URI to fetch the next page of availabilityStatuses. :vartype next_link: str @@ -105,8 +103,7 @@ def __init__( ) -> None: """ :keyword value: The list of availabilityStatuses. Required. - :paramtype value: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] + :paramtype value: list[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :keyword next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() with this URI to fetch the next page of availabilityStatuses. :paramtype next_link: str @@ -122,8 +119,7 @@ class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too :ivar availability_state: Availability status of the resource. When it is null, this availabilityStatus object represents an availability impacting event. Known values are: "Available", "Unavailable", "Degraded", and "Unknown". - :vartype availability_state: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStateValues + :vartype availability_state: str or ~azure.mgmt.resourcehealth.models.AvailabilityStateValues :ivar title: Title description of the availability status. :vartype title: str :ivar summary: Summary description of the availability status. @@ -166,22 +162,20 @@ class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too :vartype occured_time: ~datetime.datetime :ivar reason_chronicity: Chronicity of the availability transition. Known values are: "Transient" and "Persistent". - :vartype reason_chronicity: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ReasonChronicityTypes + :vartype reason_chronicity: str or ~azure.mgmt.resourcehealth.models.ReasonChronicityTypes :ivar reported_time: Timestamp for when the health was last checked. :vartype reported_time: ~datetime.datetime :ivar recently_resolved: An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned. :vartype recently_resolved: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatusPropertiesRecentlyResolved + ~azure.mgmt.resourcehealth.models.AvailabilityStatusPropertiesRecentlyResolved :ivar recommended_actions: Lists actions the user can take based on the current availabilityState of the resource. - :vartype recommended_actions: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.RecommendedAction] + :vartype recommended_actions: list[~azure.mgmt.resourcehealth.models.RecommendedAction] :ivar service_impacting_events: Lists the service impacting events that may be affecting the health of the resource. :vartype service_impacting_events: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ServiceImpactingEvent] + list[~azure.mgmt.resourcehealth.models.ServiceImpactingEvent] """ _attribute_map = { @@ -236,8 +230,7 @@ def __init__( :keyword availability_state: Availability status of the resource. When it is null, this availabilityStatus object represents an availability impacting event. Known values are: "Available", "Unavailable", "Degraded", and "Unknown". - :paramtype availability_state: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStateValues + :paramtype availability_state: str or ~azure.mgmt.resourcehealth.models.AvailabilityStateValues :keyword title: Title description of the availability status. :paramtype title: str :keyword summary: Summary description of the availability status. @@ -280,22 +273,20 @@ def __init__( :paramtype occured_time: ~datetime.datetime :keyword reason_chronicity: Chronicity of the availability transition. Known values are: "Transient" and "Persistent". - :paramtype reason_chronicity: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ReasonChronicityTypes + :paramtype reason_chronicity: str or ~azure.mgmt.resourcehealth.models.ReasonChronicityTypes :keyword reported_time: Timestamp for when the health was last checked. :paramtype reported_time: ~datetime.datetime :keyword recently_resolved: An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned. :paramtype recently_resolved: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatusPropertiesRecentlyResolved + ~azure.mgmt.resourcehealth.models.AvailabilityStatusPropertiesRecentlyResolved :keyword recommended_actions: Lists actions the user can take based on the current availabilityState of the resource. - :paramtype recommended_actions: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.RecommendedAction] + :paramtype recommended_actions: list[~azure.mgmt.resourcehealth.models.RecommendedAction] :keyword service_impacting_events: Lists the service impacting events that may be affecting the health of the resource. :paramtype service_impacting_events: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ServiceImpactingEvent] + list[~azure.mgmt.resourcehealth.models.ServiceImpactingEvent] """ super().__init__(**kwargs) self.availability_state = availability_state @@ -320,7 +311,7 @@ def __init__( self.service_impacting_events = service_impacting_events -class AvailabilityStatusPropertiesRecentlyResolved(_serialization.Model): +class AvailabilityStatusPropertiesRecentlyResolved(_serialization.Model): # pylint: disable=name-too-long """An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned. @@ -370,7 +361,7 @@ class EmergingIssueImpact(_serialization.Model): :ivar name: The impacted service name. :vartype name: str :ivar regions: The list of impacted regions for corresponding emerging issues. - :vartype regions: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ImpactedRegion] + :vartype regions: list[~azure.mgmt.resourcehealth.models.ImpactedRegion] """ _attribute_map = { @@ -393,7 +384,7 @@ def __init__( :keyword name: The impacted service name. :paramtype name: str :keyword regions: The list of impacted regions for corresponding emerging issues. - :paramtype regions: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ImpactedRegion] + :paramtype regions: list[~azure.mgmt.resourcehealth.models.ImpactedRegion] """ super().__init__(**kwargs) self.id = id @@ -405,8 +396,7 @@ class EmergingIssueListResult(_serialization.Model): """The list of emerging issues. :ivar value: The list of emerging issues. - :vartype value: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EmergingIssuesGetResult] + :vartype value: list[~azure.mgmt.resourcehealth.models.EmergingIssuesGetResult] :ivar next_link: The link used to get the next page of emerging issues. :vartype next_link: str """ @@ -425,8 +415,7 @@ def __init__( ) -> None: """ :keyword value: The list of emerging issues. - :paramtype value: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EmergingIssuesGetResult] + :paramtype value: list[~azure.mgmt.resourcehealth.models.EmergingIssuesGetResult] :keyword next_link: The link used to get the next page of emerging issues. :paramtype next_link: str """ @@ -441,7 +430,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -450,7 +439,7 @@ class Resource(_serialization.Model): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.resourcehealth.models.SystemData """ _validation = { @@ -483,7 +472,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -492,27 +481,9 @@ class ProxyResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.resourcehealth.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class EmergingIssuesGetResult(ProxyResource): """The Get EmergingIssues operation response. @@ -520,7 +491,7 @@ class EmergingIssuesGetResult(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -529,15 +500,13 @@ class EmergingIssuesGetResult(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.resourcehealth.models.SystemData :ivar refresh_timestamp: Timestamp for when last time refreshed for ongoing emerging issue. :vartype refresh_timestamp: ~datetime.datetime :ivar status_banners: The list of emerging issues of banner type. - :vartype status_banners: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.StatusBanner] + :vartype status_banners: list[~azure.mgmt.resourcehealth.models.StatusBanner] :ivar status_active_events: The list of emerging issues of active event type. - :vartype status_active_events: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.StatusActiveEvent] + :vartype status_active_events: list[~azure.mgmt.resourcehealth.models.StatusActiveEvent] """ _validation = { @@ -569,11 +538,9 @@ def __init__( :keyword refresh_timestamp: Timestamp for when last time refreshed for ongoing emerging issue. :paramtype refresh_timestamp: ~datetime.datetime :keyword status_banners: The list of emerging issues of banner type. - :paramtype status_banners: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.StatusBanner] + :paramtype status_banners: list[~azure.mgmt.resourcehealth.models.StatusBanner] :keyword status_active_events: The list of emerging issues of active event type. - :paramtype status_active_events: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.StatusActiveEvent] + :paramtype status_active_events: list[~azure.mgmt.resourcehealth.models.StatusActiveEvent] """ super().__init__(**kwargs) self.refresh_timestamp = refresh_timestamp @@ -620,7 +587,7 @@ class Event(ProxyResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -629,20 +596,17 @@ class Event(ProxyResource): # pylint: disable=too-many-instance-attributes :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.resourcehealth.models.SystemData :ivar event_type: Type of event. Known values are: "ServiceIssue", "PlannedMaintenance", "HealthAdvisory", "RCA", "EmergingIssues", and "SecurityAdvisory". - :vartype event_type: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventTypeValues + :vartype event_type: str or ~azure.mgmt.resourcehealth.models.EventTypeValues :ivar event_sub_type: Sub type of the event. Currently used to determine retirement communications for health advisory events. "Retirement" - :vartype event_sub_type: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventSubTypeValues + :vartype event_sub_type: str or ~azure.mgmt.resourcehealth.models.EventSubTypeValues :ivar event_source: Source of event. Known values are: "ResourceHealth" and "ServiceHealth". - :vartype event_source: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventSourceValues + :vartype event_source: str or ~azure.mgmt.resourcehealth.models.EventSourceValues :ivar status: Current status of event. Known values are: "Active" and "Resolved". - :vartype status: str or ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventStatusValues + :vartype status: str or ~azure.mgmt.resourcehealth.models.EventStatusValues :ivar title: Title text of event. :vartype title: str :ivar summary: Summary text of event. @@ -650,31 +614,30 @@ class Event(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar header: Header text of event. :vartype header: str :ivar level: Level of insight. Known values are: "Critical" and "Warning". - :vartype level: str or ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.LevelValues + :vartype level: str or ~azure.mgmt.resourcehealth.models.LevelValues :ivar event_level: Level of event. Known values are: "Critical", "Error", "Warning", and "Informational". - :vartype event_level: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventLevelValues + :vartype event_level: str or ~azure.mgmt.resourcehealth.models.EventLevelValues :ivar external_incident_id: The id of the Incident. :vartype external_incident_id: str :ivar reason: The reason for the Incident. :vartype reason: str :ivar article: Article of event. - :vartype article: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventPropertiesArticle + :vartype article: ~azure.mgmt.resourcehealth.models.EventPropertiesArticle :ivar links: Useful links of event. - :vartype links: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Link] + :vartype links: list[~azure.mgmt.resourcehealth.models.Link] :ivar impact_start_time: It provides the Timestamp for when the health impacting event started. :vartype impact_start_time: ~datetime.datetime :ivar impact_mitigation_time: It provides the Timestamp for when the health impacting event resolved. :vartype impact_mitigation_time: ~datetime.datetime :ivar impact: List services impacted by the service health event. - :vartype impact: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Impact] + :vartype impact: list[~azure.mgmt.resourcehealth.models.Impact] :ivar recommended_actions: Recommended actions of event. :vartype recommended_actions: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventPropertiesRecommendedActions + ~azure.mgmt.resourcehealth.models.EventPropertiesRecommendedActions :ivar faqs: Frequently asked questions for the service health event. - :vartype faqs: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Faq] + :vartype faqs: list[~azure.mgmt.resourcehealth.models.Faq] :ivar is_hir: It provides information if the event is High incident rate event or not. :vartype is_hir: bool :ivar enable_microsoft_support: Tells if we want to enable or disable Microsoft Support for @@ -700,7 +663,7 @@ class Event(ProxyResource): # pylint: disable=too-many-instance-attributes :vartype hir_stage: str :ivar additional_information: Additional information. :vartype additional_information: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventPropertiesAdditionalInformation + ~azure.mgmt.resourcehealth.models.EventPropertiesAdditionalInformation :ivar duration: duration in seconds. :vartype duration: int :ivar impact_type: The type of the impact. @@ -803,18 +766,14 @@ def __init__( # pylint: disable=too-many-locals """ :keyword event_type: Type of event. Known values are: "ServiceIssue", "PlannedMaintenance", "HealthAdvisory", "RCA", "EmergingIssues", and "SecurityAdvisory". - :paramtype event_type: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventTypeValues + :paramtype event_type: str or ~azure.mgmt.resourcehealth.models.EventTypeValues :keyword event_sub_type: Sub type of the event. Currently used to determine retirement communications for health advisory events. "Retirement" - :paramtype event_sub_type: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventSubTypeValues + :paramtype event_sub_type: str or ~azure.mgmt.resourcehealth.models.EventSubTypeValues :keyword event_source: Source of event. Known values are: "ResourceHealth" and "ServiceHealth". - :paramtype event_source: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventSourceValues + :paramtype event_source: str or ~azure.mgmt.resourcehealth.models.EventSourceValues :keyword status: Current status of event. Known values are: "Active" and "Resolved". - :paramtype status: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventStatusValues + :paramtype status: str or ~azure.mgmt.resourcehealth.models.EventStatusValues :keyword title: Title text of event. :paramtype title: str :keyword summary: Summary text of event. @@ -822,20 +781,18 @@ def __init__( # pylint: disable=too-many-locals :keyword header: Header text of event. :paramtype header: str :keyword level: Level of insight. Known values are: "Critical" and "Warning". - :paramtype level: str or ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.LevelValues + :paramtype level: str or ~azure.mgmt.resourcehealth.models.LevelValues :keyword event_level: Level of event. Known values are: "Critical", "Error", "Warning", and "Informational". - :paramtype event_level: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventLevelValues + :paramtype event_level: str or ~azure.mgmt.resourcehealth.models.EventLevelValues :keyword external_incident_id: The id of the Incident. :paramtype external_incident_id: str :keyword reason: The reason for the Incident. :paramtype reason: str :keyword article: Article of event. - :paramtype article: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventPropertiesArticle + :paramtype article: ~azure.mgmt.resourcehealth.models.EventPropertiesArticle :keyword links: Useful links of event. - :paramtype links: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Link] + :paramtype links: list[~azure.mgmt.resourcehealth.models.Link] :keyword impact_start_time: It provides the Timestamp for when the health impacting event started. :paramtype impact_start_time: ~datetime.datetime @@ -843,12 +800,12 @@ def __init__( # pylint: disable=too-many-locals resolved. :paramtype impact_mitigation_time: ~datetime.datetime :keyword impact: List services impacted by the service health event. - :paramtype impact: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Impact] + :paramtype impact: list[~azure.mgmt.resourcehealth.models.Impact] :keyword recommended_actions: Recommended actions of event. :paramtype recommended_actions: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventPropertiesRecommendedActions + ~azure.mgmt.resourcehealth.models.EventPropertiesRecommendedActions :keyword faqs: Frequently asked questions for the service health event. - :paramtype faqs: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Faq] + :paramtype faqs: list[~azure.mgmt.resourcehealth.models.Faq] :keyword is_hir: It provides information if the event is High incident rate event or not. :paramtype is_hir: bool :keyword enable_microsoft_support: Tells if we want to enable or disable Microsoft Support for @@ -874,7 +831,7 @@ def __init__( # pylint: disable=too-many-locals :paramtype hir_stage: str :keyword additional_information: Additional information. :paramtype additional_information: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventPropertiesAdditionalInformation + ~azure.mgmt.resourcehealth.models.EventPropertiesAdditionalInformation :keyword duration: duration in seconds. :paramtype duration: int :keyword impact_type: The type of the impact. @@ -928,7 +885,7 @@ class EventImpactedResource(ProxyResource): # pylint: disable=too-many-instance Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -937,7 +894,7 @@ class EventImpactedResource(ProxyResource): # pylint: disable=too-many-instance :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.resourcehealth.models.SystemData :ivar target_resource_type: Resource type within Microsoft cloud. :vartype target_resource_type: str :ivar target_resource_id: Identity for resource within Microsoft cloud. @@ -955,7 +912,7 @@ class EventImpactedResource(ProxyResource): # pylint: disable=too-many-instance :ivar maintenance_end_time: End time of maintenance for the impacted resource. :vartype maintenance_end_time: str :ivar info: Additional information. - :vartype info: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.KeyValueItem] + :vartype info: list[~azure.mgmt.resourcehealth.models.KeyValueItem] """ _validation = { @@ -992,7 +949,7 @@ class EventImpactedResource(ProxyResource): # pylint: disable=too-many-instance def __init__(self, *, info: Optional[List["_models.KeyValueItem"]] = None, **kwargs: Any) -> None: """ :keyword info: Additional information. - :paramtype info: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.KeyValueItem] + :paramtype info: list[~azure.mgmt.resourcehealth.models.KeyValueItem] """ super().__init__(**kwargs) self.target_resource_type = None @@ -1009,11 +966,10 @@ def __init__(self, *, info: Optional[List["_models.KeyValueItem"]] = None, **kwa class EventImpactedResourceListResult(_serialization.Model): """The List of eventImpactedResources operation response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The list of eventImpactedResources. Required. - :vartype value: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] + :vartype value: list[~azure.mgmt.resourcehealth.models.EventImpactedResource] :ivar next_link: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of impacted resource. :vartype next_link: str @@ -1033,8 +989,7 @@ def __init__( ) -> None: """ :keyword value: The list of eventImpactedResources. Required. - :paramtype value: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] + :paramtype value: list[~azure.mgmt.resourcehealth.models.EventImpactedResource] :keyword next_link: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of impacted resource. :paramtype next_link: str @@ -1109,8 +1064,7 @@ class EventPropertiesRecommendedActions(_serialization.Model): :ivar message: Recommended action title for the service health event. :vartype message: str :ivar actions: Recommended actions for the service health event. - :vartype actions: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventPropertiesRecommendedActionsItem] + :vartype actions: list[~azure.mgmt.resourcehealth.models.EventPropertiesRecommendedActionsItem] :ivar locale_code: Recommended action locale for the service health event. :vartype locale_code: str """ @@ -1134,7 +1088,7 @@ def __init__( :paramtype message: str :keyword actions: Recommended actions for the service health event. :paramtype actions: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventPropertiesRecommendedActionsItem] + list[~azure.mgmt.resourcehealth.models.EventPropertiesRecommendedActionsItem] :keyword locale_code: Recommended action locale for the service health event. :paramtype locale_code: str """ @@ -1173,10 +1127,10 @@ def __init__(self, *, group_id: Optional[int] = None, action_text: Optional[str] class Events(_serialization.Model): """The List events operation response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The list of event. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event] + :vartype value: list[~azure.mgmt.resourcehealth.models.Event] :ivar next_link: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of events. :vartype next_link: str @@ -1194,7 +1148,7 @@ class Events(_serialization.Model): def __init__(self, *, value: List["_models.Event"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The list of event. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event] + :paramtype value: list[~azure.mgmt.resourcehealth.models.Event] :keyword next_link: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of events. :paramtype next_link: str @@ -1249,8 +1203,7 @@ class Impact(_serialization.Model): :ivar impacted_service: Impacted service name. :vartype impacted_service: str :ivar impacted_regions: List regions impacted by the service health event. - :vartype impacted_regions: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ImpactedServiceRegion] + :vartype impacted_regions: list[~azure.mgmt.resourcehealth.models.ImpactedServiceRegion] """ _attribute_map = { @@ -1269,8 +1222,7 @@ def __init__( :keyword impacted_service: Impacted service name. :paramtype impacted_service: str :keyword impacted_regions: List regions impacted by the service health event. - :paramtype impacted_regions: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ImpactedServiceRegion] + :paramtype impacted_regions: list[~azure.mgmt.resourcehealth.models.ImpactedServiceRegion] """ super().__init__(**kwargs) self.impacted_service = impacted_service @@ -1315,7 +1267,7 @@ class ImpactedResourceStatus(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1324,11 +1276,10 @@ class ImpactedResourceStatus(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.resourcehealth.models.SystemData :ivar availability_state: Impacted resource status of the resource. Known values are: "Available", "Unavailable", "Degraded", and "Unknown". - :vartype availability_state: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStateValues + :vartype availability_state: str or ~azure.mgmt.resourcehealth.models.AvailabilityStateValues :ivar title: Title description of the impacted resource status. :vartype title: str :ivar summary: Summary description of the impacted resource status. @@ -1336,8 +1287,7 @@ class ImpactedResourceStatus(ProxyResource): :ivar reason_type: When the resource's availabilityState is Unavailable, it describes where the health impacting event was originated. Known values are: "Unplanned", "Planned", and "UserInitiated". - :vartype reason_type: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ReasonTypeValues + :vartype reason_type: str or ~azure.mgmt.resourcehealth.models.ReasonTypeValues :ivar occurred_time: Timestamp for when last change in health status occurred. :vartype occurred_time: ~datetime.datetime """ @@ -1374,8 +1324,7 @@ def __init__( """ :keyword availability_state: Impacted resource status of the resource. Known values are: "Available", "Unavailable", "Degraded", and "Unknown". - :paramtype availability_state: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStateValues + :paramtype availability_state: str or ~azure.mgmt.resourcehealth.models.AvailabilityStateValues :keyword title: Title description of the impacted resource status. :paramtype title: str :keyword summary: Summary description of the impacted resource status. @@ -1383,8 +1332,7 @@ def __init__( :keyword reason_type: When the resource's availabilityState is Unavailable, it describes where the health impacting event was originated. Known values are: "Unplanned", "Planned", and "UserInitiated". - :paramtype reason_type: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ReasonTypeValues + :paramtype reason_type: str or ~azure.mgmt.resourcehealth.models.ReasonTypeValues :keyword occurred_time: Timestamp for when last change in health status occurred. :paramtype occurred_time: ~datetime.datetime """ @@ -1402,7 +1350,7 @@ class ImpactedServiceRegion(_serialization.Model): :ivar impacted_region: Impacted region name. :vartype impacted_region: str :ivar status: Current status of event in the region. Known values are: "Active" and "Resolved". - :vartype status: str or ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventStatusValues + :vartype status: str or ~azure.mgmt.resourcehealth.models.EventStatusValues :ivar impacted_subscriptions: List subscription impacted by the service health event. :vartype impacted_subscriptions: list[str] :ivar impacted_tenants: List tenant impacted by the service health event. @@ -1411,7 +1359,7 @@ class ImpactedServiceRegion(_serialization.Model): health event. :vartype last_update_time: ~datetime.datetime :ivar updates: List of updates for given service health event. - :vartype updates: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Update] + :vartype updates: list[~azure.mgmt.resourcehealth.models.Update] """ _attribute_map = { @@ -1439,8 +1387,7 @@ def __init__( :paramtype impacted_region: str :keyword status: Current status of event in the region. Known values are: "Active" and "Resolved". - :paramtype status: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventStatusValues + :paramtype status: str or ~azure.mgmt.resourcehealth.models.EventStatusValues :keyword impacted_subscriptions: List subscription impacted by the service health event. :paramtype impacted_subscriptions: list[str] :keyword impacted_tenants: List tenant impacted by the service health event. @@ -1449,7 +1396,7 @@ def __init__( health event. :paramtype last_update_time: ~datetime.datetime :keyword updates: List of updates for given service health event. - :paramtype updates: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Update] + :paramtype updates: list[~azure.mgmt.resourcehealth.models.Update] """ super().__init__(**kwargs) self.impacted_region = impacted_region @@ -1492,9 +1439,9 @@ class Link(_serialization.Model): """Useful links for service health event. :ivar type: Type of link. Known values are: "Button" and "Hyperlink". - :vartype type: str or ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.LinkTypeValues + :vartype type: str or ~azure.mgmt.resourcehealth.models.LinkTypeValues :ivar display_text: Display text of link. - :vartype display_text: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.LinkDisplayText + :vartype display_text: ~azure.mgmt.resourcehealth.models.LinkDisplayText :ivar extension_name: It provides the name of portal extension to produce link for given service health event. :vartype extension_name: str @@ -1526,9 +1473,9 @@ def __init__( ) -> None: """ :keyword type: Type of link. Known values are: "Button" and "Hyperlink". - :paramtype type: str or ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.LinkTypeValues + :paramtype type: str or ~azure.mgmt.resourcehealth.models.LinkTypeValues :keyword display_text: Display text of link. - :paramtype display_text: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.LinkDisplayText + :paramtype display_text: ~azure.mgmt.resourcehealth.models.LinkDisplayText :keyword extension_name: It provides the name of portal extension to produce link for given service health event. :paramtype extension_name: str @@ -1579,7 +1526,7 @@ class MetadataEntity(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1588,17 +1535,15 @@ class MetadataEntity(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.resourcehealth.models.SystemData :ivar display_name: The display name. :vartype display_name: str :ivar depends_on: The list of keys on which this entity depends on. :vartype depends_on: list[str] :ivar applicable_scenarios: The list of scenarios applicable to this metadata entity. - :vartype applicable_scenarios: list[str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Scenario] + :vartype applicable_scenarios: list[str or ~azure.mgmt.resourcehealth.models.Scenario] :ivar supported_values: The list of supported values. - :vartype supported_values: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.MetadataSupportedValueDetail] + :vartype supported_values: list[~azure.mgmt.resourcehealth.models.MetadataSupportedValueDetail] """ _validation = { @@ -1634,11 +1579,10 @@ def __init__( :keyword depends_on: The list of keys on which this entity depends on. :paramtype depends_on: list[str] :keyword applicable_scenarios: The list of scenarios applicable to this metadata entity. - :paramtype applicable_scenarios: list[str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Scenario] + :paramtype applicable_scenarios: list[str or ~azure.mgmt.resourcehealth.models.Scenario] :keyword supported_values: The list of supported values. :paramtype supported_values: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.MetadataSupportedValueDetail] + list[~azure.mgmt.resourcehealth.models.MetadataSupportedValueDetail] """ super().__init__(**kwargs) self.display_name = display_name @@ -1651,7 +1595,7 @@ class MetadataEntityListResult(_serialization.Model): """The list of metadata entities. :ivar value: The list of metadata entities. - :vartype value: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.MetadataEntity] + :vartype value: list[~azure.mgmt.resourcehealth.models.MetadataEntity] :ivar next_link: The link used to get the next page of metadata. :vartype next_link: str """ @@ -1666,7 +1610,7 @@ def __init__( ) -> None: """ :keyword value: The list of metadata entities. - :paramtype value: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.MetadataEntity] + :paramtype value: list[~azure.mgmt.resourcehealth.models.MetadataEntity] :keyword next_link: The link used to get the next page of metadata. :paramtype next_link: str """ @@ -1720,7 +1664,7 @@ class Operation(_serialization.Model): :ivar name: Name of the operation. :vartype name: str :ivar display: Properties of the operation. - :vartype display: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.OperationDisplay + :vartype display: ~azure.mgmt.resourcehealth.models.OperationDisplay """ _attribute_map = { @@ -1735,7 +1679,7 @@ def __init__( :keyword name: Name of the operation. :paramtype name: str :keyword display: Properties of the operation. - :paramtype display: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.OperationDisplay + :paramtype display: ~azure.mgmt.resourcehealth.models.OperationDisplay """ super().__init__(**kwargs) self.name = name @@ -1791,11 +1735,11 @@ def __init__( class OperationListResult(_serialization.Model): """Lists the operations response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: List of operations available in the Microsoft.ResourceHealth resource provider. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Operation] + :vartype value: list[~azure.mgmt.resourcehealth.models.Operation] """ _validation = { @@ -1810,7 +1754,7 @@ def __init__(self, *, value: List["_models.Operation"], **kwargs: Any) -> None: """ :keyword value: List of operations available in the Microsoft.ResourceHealth resource provider. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Operation] + :paramtype value: list[~azure.mgmt.resourcehealth.models.Operation] """ super().__init__(**kwargs) self.value = value @@ -1873,11 +1817,10 @@ class ServiceImpactingEvent(_serialization.Model): :ivar correlation_id: Correlation id for the event. :vartype correlation_id: str :ivar status: Status of the service impacting event. - :vartype status: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ServiceImpactingEventStatus + :vartype status: ~azure.mgmt.resourcehealth.models.ServiceImpactingEventStatus :ivar incident_properties: Properties of the service impacting event. :vartype incident_properties: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ServiceImpactingEventIncidentProperties + ~azure.mgmt.resourcehealth.models.ServiceImpactingEventIncidentProperties """ _attribute_map = { @@ -1906,11 +1849,10 @@ def __init__( :keyword correlation_id: Correlation id for the event. :paramtype correlation_id: str :keyword status: Status of the service impacting event. - :paramtype status: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ServiceImpactingEventStatus + :paramtype status: ~azure.mgmt.resourcehealth.models.ServiceImpactingEventStatus :keyword incident_properties: Properties of the service impacting event. :paramtype incident_properties: - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.ServiceImpactingEventIncidentProperties + ~azure.mgmt.resourcehealth.models.ServiceImpactingEventIncidentProperties """ super().__init__(**kwargs) self.event_start_time = event_start_time @@ -2001,17 +1943,16 @@ class StatusActiveEvent(_serialization.Model): :vartype cloud: str :ivar severity: The severity level of this active event. Known values are: "Information", "Warning", and "Error". - :vartype severity: str or ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.SeverityValues + :vartype severity: str or ~azure.mgmt.resourcehealth.models.SeverityValues :ivar stage: The stage of this active event. Known values are: "Active", "Resolve", and "Archived". - :vartype stage: str or ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.StageValues + :vartype stage: str or ~azure.mgmt.resourcehealth.models.StageValues :ivar published: The boolean value of this active event if published or not. :vartype published: bool :ivar last_modified_time: The last time modified on this banner. :vartype last_modified_time: ~datetime.datetime :ivar impacts: The list of emerging issues impacts. - :vartype impacts: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EmergingIssueImpact] + :vartype impacts: list[~azure.mgmt.resourcehealth.models.EmergingIssueImpact] """ _attribute_map = { @@ -2055,18 +1996,16 @@ def __init__( :paramtype cloud: str :keyword severity: The severity level of this active event. Known values are: "Information", "Warning", and "Error". - :paramtype severity: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.SeverityValues + :paramtype severity: str or ~azure.mgmt.resourcehealth.models.SeverityValues :keyword stage: The stage of this active event. Known values are: "Active", "Resolve", and "Archived". - :paramtype stage: str or ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.StageValues + :paramtype stage: str or ~azure.mgmt.resourcehealth.models.StageValues :keyword published: The boolean value of this active event if published or not. :paramtype published: bool :keyword last_modified_time: The last time modified on this banner. :paramtype last_modified_time: ~datetime.datetime :keyword impacts: The list of emerging issues impacts. - :paramtype impacts: - list[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EmergingIssueImpact] + :paramtype impacts: list[~azure.mgmt.resourcehealth.models.EmergingIssueImpact] """ super().__init__(**kwargs) self.title = title @@ -2134,16 +2073,14 @@ class SystemData(_serialization.Model): :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.resourcehealth.v2023_10_01_preview.models.CreatedByType + :vartype created_by_type: str or ~azure.mgmt.resourcehealth.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.resourcehealth.v2023_10_01_preview.models.CreatedByType + :vartype last_modified_by_type: str or ~azure.mgmt.resourcehealth.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime """ @@ -2173,16 +2110,14 @@ def __init__( :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.resourcehealth.v2023_10_01_preview.models.CreatedByType + :paramtype created_by_type: str or ~azure.mgmt.resourcehealth.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.resourcehealth.v2023_10_01_preview.models.CreatedByType + :paramtype last_modified_by_type: str or ~azure.mgmt.resourcehealth.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models/_patch.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_patch.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models/_patch.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/_resource_health_mgmt_client_enums.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models/_resource_health_mgmt_client_enums.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/_resource_health_mgmt_client_enums.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models/_resource_health_mgmt_client_enums.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/__init__.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/__init__.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/__init__.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_availability_statuses_operations.py similarity index 83% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_availability_statuses_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_availability_statuses_operations.py index 70ca087e83a1..1c27ac182911 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_availability_statuses_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +45,7 @@ def build_list_by_subscription_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +82,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +118,7 @@ def build_get_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +148,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -175,7 +178,7 @@ class AvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`availability_statuses` attribute. """ @@ -187,7 +190,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription_id( @@ -202,19 +204,17 @@ def list_by_subscription_id( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,17 +225,15 @@ def list_by_subscription_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_id_request( + _request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, filter=filter, expand=expand, api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -247,13 +245,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -263,11 +260,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -280,10 +277,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any @@ -300,19 +293,17 @@ def list_by_resource_group( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -323,18 +314,16 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, filter=filter, expand=expand, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -346,13 +335,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -362,11 +350,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -379,10 +367,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - @distributed_trace def get_by_resource( self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any @@ -403,12 +387,11 @@ def get_by_resource( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus + :rtype: ~azure.mgmt.resourcehealth.models.AvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,24 +402,22 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - request = build_get_by_resource_request( + _request = build_get_by_resource_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.get_by_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -446,14 +427,12 @@ def get_by_resource( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) + deserialized = self._deserialize("AvailabilityStatus", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} + return deserialized # type: ignore @distributed_trace def list( @@ -475,19 +454,17 @@ def list( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -498,17 +475,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -520,13 +495,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -536,11 +510,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,5 +526,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_child_availability_statuses_operations.py similarity index 83% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_availability_statuses_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_child_availability_statuses_operations.py index 655968fa5859..50ccf83ac0ac 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_child_availability_statuses_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +45,7 @@ def build_get_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +77,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +107,7 @@ class ChildAvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`child_availability_statuses` attribute. """ @@ -116,7 +119,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get_by_resource( @@ -136,12 +138,11 @@ def get_by_resource( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus + :rtype: ~azure.mgmt.resourcehealth.models.AvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -152,24 +153,22 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - request = build_get_by_resource_request( + _request = build_get_by_resource_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.get_by_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,16 +178,12 @@ def get_by_resource( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) + deserialized = self._deserialize("AvailabilityStatus", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_resource.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" - } + return deserialized # type: ignore @distributed_trace def list( @@ -209,19 +204,17 @@ def list( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -232,17 +225,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -254,13 +245,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -270,11 +260,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,5 +276,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_child_resources_operations.py similarity index 83% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_child_resources_operations.py index f2e14c3a83d9..823336fbdee7 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_child_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +75,7 @@ class ChildResourcesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`child_resources` attribute. """ @@ -84,7 +87,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -105,19 +107,17 @@ def list( :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions in the response. Default value is None. :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.AvailabilityStatus] :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._api_version or "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,17 +128,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, filter=filter, expand=expand, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -150,13 +148,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) @@ -166,11 +163,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,5 +179,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_emerging_issues_operations.py similarity index 78% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_emerging_issues_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_emerging_issues_operations.py index 55034311246a..27009e0dcbb1 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_emerging_issues_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_emerging_issues_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +62,7 @@ def build_get_request(issue_name: Union[str, _models.IssueNameParameter], **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +88,7 @@ class EmergingIssuesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`emerging_issues` attribute. """ @@ -97,26 +100,23 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: """Lists Azure services' emerging issues. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EmergingIssuesGetResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.EmergingIssuesGetResult] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,14 +127,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -146,13 +144,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EmergingIssueListResult", pipeline_response) @@ -162,11 +159,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,20 +176,17 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} - @distributed_trace def get(self, issue_name: Union[str, _models.IssueNameParameter], **kwargs: Any) -> _models.EmergingIssuesGetResult: """Gets Azure services' emerging issues. :param issue_name: The name of the emerging issue. "default" Required. - :type issue_name: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.IssueNameParameter - :keyword callable cls: A custom type or function that will be passed the direct response + :type issue_name: str or ~azure.mgmt.resourcehealth.models.IssueNameParameter :return: EmergingIssuesGetResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult + :rtype: ~azure.mgmt.resourcehealth.models.EmergingIssuesGetResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,22 +197,20 @@ def get(self, issue_name: Union[str, _models.IssueNameParameter], **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( issue_name=issue_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -228,11 +220,9 @@ def get(self, issue_name: Union[str, _models.IssueNameParameter], **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response) + deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_event_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_event_operations.py similarity index 77% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_event_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_event_operations.py index 7a0b81cf10a9..877858454943 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_event_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_event_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_get_by_subscription_id_and_tracking_id_request( +def build_get_by_subscription_id_and_tracking_id_request( # pylint: disable=name-too-long event_tracking_id: str, subscription_id: str, *, @@ -45,7 +48,7 @@ def build_get_by_subscription_id_and_tracking_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,13 +75,13 @@ def build_get_by_subscription_id_and_tracking_id_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_fetch_details_by_subscription_id_and_tracking_id_request( +def build_fetch_details_by_subscription_id_and_tracking_id_request( # pylint: disable=name-too-long event_tracking_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,13 +105,13 @@ def build_fetch_details_by_subscription_id_and_tracking_id_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_by_tenant_id_and_tracking_id_request( +def build_get_by_tenant_id_and_tracking_id_request( # pylint: disable=name-too-long event_tracking_id: str, *, filter: Optional[str] = None, query_start_time: 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", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,11 +135,13 @@ def build_get_by_tenant_id_and_tracking_id_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_fetch_details_by_tenant_id_and_tracking_id_request(event_tracking_id: str, **kwargs: Any) -> HttpRequest: +def build_fetch_details_by_tenant_id_and_tracking_id_request( # pylint: disable=name-too-long + event_tracking_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", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +167,7 @@ class EventOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`event` attribute. """ @@ -174,7 +179,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get_by_subscription_id_and_tracking_id( @@ -196,12 +200,11 @@ def get_by_subscription_id_and_tracking_id( property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default value is None. :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :rtype: ~azure.mgmt.resourcehealth.models.Event :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,25 +215,23 @@ def get_by_subscription_id_and_tracking_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Event] = kwargs.pop("cls", None) - request = build_get_by_subscription_id_and_tracking_id_request( + _request = build_get_by_subscription_id_and_tracking_id_request( event_tracking_id=event_tracking_id, subscription_id=self._config.subscription_id, filter=filter, query_start_time=query_start_time, api_version=api_version, - template_url=self.get_by_subscription_id_and_tracking_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,30 +241,27 @@ def get_by_subscription_id_and_tracking_id( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Event", pipeline_response) + deserialized = self._deserialize("Event", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_subscription_id_and_tracking_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" - } + return deserialized # type: ignore @distributed_trace - def fetch_details_by_subscription_id_and_tracking_id(self, event_tracking_id: str, **kwargs: Any) -> _models.Event: + def fetch_details_by_subscription_id_and_tracking_id( # pylint: disable=name-too-long + self, event_tracking_id: str, **kwargs: Any + ) -> _models.Event: """Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events. :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. :type event_tracking_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :rtype: ~azure.mgmt.resourcehealth.models.Event :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,23 +272,21 @@ def fetch_details_by_subscription_id_and_tracking_id(self, event_tracking_id: st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Event] = kwargs.pop("cls", None) - request = build_fetch_details_by_subscription_id_and_tracking_id_request( + _request = build_fetch_details_by_subscription_id_and_tracking_id_request( event_tracking_id=event_tracking_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.fetch_details_by_subscription_id_and_tracking_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,16 +296,12 @@ def fetch_details_by_subscription_id_and_tracking_id(self, event_tracking_id: st error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Event", pipeline_response) + deserialized = self._deserialize("Event", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - fetch_details_by_subscription_id_and_tracking_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" - } + return deserialized # type: ignore @distributed_trace def get_by_tenant_id_and_tracking_id( @@ -331,12 +323,11 @@ def get_by_tenant_id_and_tracking_id( property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default value is None. :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :rtype: ~azure.mgmt.resourcehealth.models.Event :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,24 +338,22 @@ def get_by_tenant_id_and_tracking_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Event] = kwargs.pop("cls", None) - request = build_get_by_tenant_id_and_tracking_id_request( + _request = build_get_by_tenant_id_and_tracking_id_request( event_tracking_id=event_tracking_id, filter=filter, query_start_time=query_start_time, api_version=api_version, - template_url=self.get_by_tenant_id_and_tracking_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,28 +363,27 @@ def get_by_tenant_id_and_tracking_id( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Event", pipeline_response) + deserialized = self._deserialize("Event", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_tenant_id_and_tracking_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"} + return deserialized # type: ignore @distributed_trace - def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: str, **kwargs: Any) -> _models.Event: + def fetch_details_by_tenant_id_and_tracking_id( # pylint: disable=name-too-long + self, event_tracking_id: str, **kwargs: Any + ) -> _models.Event: """Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events. :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. :type event_tracking_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :rtype: ~azure.mgmt.resourcehealth.models.Event :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,22 +394,20 @@ def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Event] = kwargs.pop("cls", None) - request = build_fetch_details_by_tenant_id_and_tracking_id_request( + _request = build_fetch_details_by_tenant_id_and_tracking_id_request( event_tracking_id=event_tracking_id, api_version=api_version, - template_url=self.fetch_details_by_tenant_id_and_tracking_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -431,13 +417,9 @@ def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: str, **k error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Event", pipeline_response) + deserialized = self._deserialize("Event", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - fetch_details_by_tenant_id_and_tracking_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" - } + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_events_operations.py similarity index 83% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_events_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_events_operations.py index 7a735558db7f..066524272465 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_events_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_events_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +45,7 @@ def build_list_by_subscription_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +75,7 @@ def build_list_by_tenant_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +100,7 @@ def build_list_by_single_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +128,7 @@ class EventsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`events` attribute. """ @@ -137,7 +140,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription_id( @@ -153,18 +155,17 @@ def list_by_subscription_id( property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default value is None. :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Event or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.Event] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Events] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,17 +176,15 @@ def list_by_subscription_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_id_request( + _request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, filter=filter, query_start_time=query_start_time, api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -197,13 +196,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) @@ -213,11 +211,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,10 +228,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" - } - @distributed_trace def list_by_tenant_id( self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any @@ -248,18 +242,17 @@ def list_by_tenant_id( property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default value is None. :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Event or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.Event] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Events] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,16 +263,14 @@ def list_by_tenant_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tenant_id_request( + _request = build_list_by_tenant_id_request( filter=filter, query_start_time=query_start_time, api_version=api_version, - template_url=self.list_by_tenant_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -291,13 +282,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) @@ -307,11 +297,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +314,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_tenant_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events"} - @distributed_trace def list_by_single_resource( self, resource_uri: str, filter: Optional[str] = None, **kwargs: Any @@ -343,18 +331,17 @@ def list_by_single_resource( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Event or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.Event] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Events] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -365,16 +352,14 @@ def list_by_single_resource( def prepare_request(next_link=None): if not next_link: - request = build_list_by_single_resource_request( + _request = build_list_by_single_resource_request( resource_uri=resource_uri, filter=filter, api_version=api_version, - template_url=self.list_by_single_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -386,13 +371,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) @@ -402,11 +386,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,5 +402,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_impacted_resources_operations.py similarity index 80% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_impacted_resources_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_impacted_resources_operations.py index 24c5614010df..0766c0080e82 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_impacted_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_impacted_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,13 +39,13 @@ _SERIALIZER.client_side_validation = False -def build_list_by_subscription_id_and_event_id_request( +def build_list_by_subscription_id_and_event_id_request( # pylint: disable=name-too-long event_tracking_id: str, subscription_id: str, *, filter: 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", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,13 +104,13 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_tenant_id_and_event_id_request( +def build_list_by_tenant_id_and_event_id_request( # pylint: disable=name-too-long event_tracking_id: str, *, filter: 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", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +136,7 @@ def build_get_by_tenant_id_request(event_tracking_id: str, impacted_resource_nam _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +168,7 @@ class ImpactedResourcesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`impacted_resources` attribute. """ @@ -177,7 +180,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription_id_and_event_id( @@ -191,20 +193,18 @@ def list_by_subscription_id_and_event_id( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventImpactedResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.EventImpactedResource] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,17 +215,15 @@ def list_by_subscription_id_and_event_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_id_and_event_id_request( + _request = build_list_by_subscription_id_and_event_id_request( event_tracking_id=event_tracking_id, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_subscription_id_and_event_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -237,13 +235,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) @@ -253,11 +250,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -270,10 +267,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id_and_event_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" - } - @distributed_trace def get(self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any) -> _models.EventImpactedResource: """Gets the specific impacted resource in the subscription by an event. @@ -282,12 +275,11 @@ def get(self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any :type event_tracking_id: str :param impacted_resource_name: Name of the Impacted Resource. Required. :type impacted_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EventImpactedResource or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource + :rtype: ~azure.mgmt.resourcehealth.models.EventImpactedResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,24 +290,22 @@ def get(self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( event_tracking_id=event_tracking_id, impacted_resource_name=impacted_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,16 +315,12 @@ def get(self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventImpactedResource", pipeline_response) + deserialized = self._deserialize("EventImpactedResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_tenant_id_and_event_id( @@ -348,20 +334,18 @@ def list_by_tenant_id_and_event_id( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventImpactedResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.EventImpactedResource] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,16 +356,14 @@ def list_by_tenant_id_and_event_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tenant_id_and_event_id_request( + _request = build_list_by_tenant_id_and_event_id_request( event_tracking_id=event_tracking_id, filter=filter, api_version=api_version, - template_url=self.list_by_tenant_id_and_event_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -393,13 +375,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) @@ -409,11 +390,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -426,10 +407,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_tenant_id_and_event_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" - } - @distributed_trace def get_by_tenant_id( self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any @@ -440,12 +417,11 @@ def get_by_tenant_id( :type event_tracking_id: str :param impacted_resource_name: Name of the Impacted Resource. Required. :type impacted_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EventImpactedResource or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource + :rtype: ~azure.mgmt.resourcehealth.models.EventImpactedResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -456,23 +432,21 @@ def get_by_tenant_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) - request = build_get_by_tenant_id_request( + _request = build_get_by_tenant_id_request( event_tracking_id=event_tracking_id, impacted_resource_name=impacted_resource_name, api_version=api_version, - template_url=self.get_by_tenant_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -482,13 +456,9 @@ def get_by_tenant_id( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventImpactedResource", pipeline_response) + deserialized = self._deserialize("EventImpactedResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_tenant_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" - } + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_metadata_operations.py similarity index 79% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_metadata_operations.py index 4e244f8af4a4..aea6680f45d1 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_metadata_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +62,7 @@ def build_get_entity_request(name: 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", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +88,7 @@ class MetadataOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`metadata` attribute. """ @@ -97,25 +100,22 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.MetadataEntity"]: """Gets the list of metadata entities. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetadataEntity or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.MetadataEntity] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.MetadataEntity] :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._api_version or "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,14 +126,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.MetadataEntity"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -145,13 +143,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("MetadataEntityListResult", pipeline_response) @@ -161,11 +158,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,20 +175,17 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} - @distributed_trace def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: """Gets the list of metadata entities. :param name: Name of metadata entity. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MetadataEntity or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2018_07_01.models.MetadataEntity + :rtype: ~azure.mgmt.resourcehealth.models.MetadataEntity :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,22 +196,20 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) - request = build_get_entity_request( + _request = build_get_entity_request( name=name, api_version=api_version, - template_url=self.get_entity.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -227,11 +219,9 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MetadataEntity", pipeline_response) + deserialized = self._deserialize("MetadataEntity", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_operations.py similarity index 77% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_operations.py index a2bdc6565631..a5c370c0093f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +41,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +62,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`operations` attribute. """ @@ -71,18 +74,16 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> _models.OperationListResult: """Lists available operations for the resourcehealth resource provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2015_01_01.models.OperationListResult + :rtype: ~azure.mgmt.resourcehealth.models.OperationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,21 +94,19 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,11 +116,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} + return deserialized # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_patch.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_patch.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_patch.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_security_advisory_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_security_advisory_impacted_resources_operations.py similarity index 80% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_security_advisory_impacted_resources_operations.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_security_advisory_impacted_resources_operations.py index 64715383ba9e..0741345a002c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_security_advisory_impacted_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/operations/_security_advisory_impacted_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.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 ..._serialization import Serializer -from .._vendor import _convert_request +from .._serialization import Serializer +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,13 +39,13 @@ _SERIALIZER.client_side_validation = False -def build_list_by_subscription_id_and_event_id_request( +def build_list_by_subscription_id_and_event_id_request( # pylint: disable=name-too-long event_tracking_id: str, subscription_id: str, *, filter: 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", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,13 +71,13 @@ def build_list_by_subscription_id_and_event_id_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_tenant_id_and_event_id_request( +def build_list_by_tenant_id_and_event_id_request( # pylint: disable=name-too-long event_tracking_id: str, *, filter: 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", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,13 +102,13 @@ def build_list_by_tenant_id_and_event_id_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class SecurityAdvisoryImpactedResourcesOperations: +class SecurityAdvisoryImpactedResourcesOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :class:`~azure.mgmt.resourcehealth.ResourceHealthMgmtClient`'s :attr:`security_advisory_impacted_resources` attribute. """ @@ -117,7 +120,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription_id_and_event_id( @@ -131,20 +133,18 @@ def list_by_subscription_id_and_event_id( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventImpactedResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.EventImpactedResource] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,17 +155,15 @@ def list_by_subscription_id_and_event_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_id_and_event_id_request( + _request = build_list_by_subscription_id_and_event_id_request( event_tracking_id=event_tracking_id, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_subscription_id_and_event_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -177,13 +175,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) @@ -193,11 +190,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -210,10 +207,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id_and_event_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" - } - @distributed_trace def list_by_tenant_id_and_event_id( self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any @@ -226,20 +219,18 @@ def list_by_tenant_id_and_event_id( https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventImpactedResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.models.EventImpactedResource] :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._api_version or "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -250,16 +241,14 @@ def list_by_tenant_id_and_event_id( def prepare_request(next_link=None): if not next_link: - request = build_list_by_tenant_id_and_event_id_request( + _request = build_list_by_tenant_id_and_event_id_request( event_tracking_id=event_tracking_id, filter=filter, api_version=api_version, - template_url=self.list_by_tenant_id_and_event_id.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -271,13 +260,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) @@ -287,11 +275,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,7 +291,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_tenant_id_and_event_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" - } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py deleted file mode 100644 index f1e7a4fdd09e..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py +++ /dev/null @@ -1,26 +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 ._resource_health_mgmt_client import ResourceHealthMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ResourceHealthMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py deleted file mode 100644 index 4b9e5fb82be8..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py +++ /dev/null @@ -1,67 +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 typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ResourceHealthMgmtClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2015-01-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2015-01-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json deleted file mode 100644 index 11cff5bc1522..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "chosen_version": "2015-01-01", - "total_api_version_list": ["2015-01-01"], - "client": { - "name": "ResourceHealthMgmtClient", - "filename": "_resource_health_mgmt_client", - "description": "The Resource Health Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "availability_statuses": "AvailabilityStatusesOperations", - "child_availability_statuses": "ChildAvailabilityStatusesOperations", - "child_resources": "ChildResourcesOperations", - "operations": "Operations" - } -} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_resource_health_mgmt_client.py deleted file mode 100644 index 6c3bb22ad3c9..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_resource_health_mgmt_client.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ResourceHealthMgmtClientConfiguration -from .operations import ( - AvailabilityStatusesOperations, - ChildAvailabilityStatusesOperations, - ChildResourcesOperations, - Operations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The Resource Health Client. - - :ivar availability_statuses: AvailabilityStatusesOperations operations - :vartype availability_statuses: - azure.mgmt.resourcehealth.v2015_01_01.operations.AvailabilityStatusesOperations - :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations - :vartype child_availability_statuses: - azure.mgmt.resourcehealth.v2015_01_01.operations.ChildAvailabilityStatusesOperations - :ivar child_resources: ChildResourcesOperations operations - :vartype child_resources: - azure.mgmt.resourcehealth.v2015_01_01.operations.ChildResourcesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resourcehealth.v2015_01_01.operations.Operations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2015-01-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ResourceHealthMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.availability_statuses = AvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2015-01-01" - ) - self.child_availability_statuses = ChildAvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2015-01-01" - ) - self.child_resources = ChildResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2015-01-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2015-01-01") - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "ResourceHealthMgmtClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_vendor.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py deleted file mode 100644 index 9cf33092d41b..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b5" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py deleted file mode 100644 index d95ad182aa0f..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py +++ /dev/null @@ -1,23 +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 ._resource_health_mgmt_client import ResourceHealthMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ResourceHealthMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py deleted file mode 100644 index b6c8dafa45bd..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py +++ /dev/null @@ -1,67 +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 typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ResourceHealthMgmtClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2015-01-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2015-01-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_resource_health_mgmt_client.py deleted file mode 100644 index 854fa5dfdbdf..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_resource_health_mgmt_client.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ResourceHealthMgmtClientConfiguration -from .operations import ( - AvailabilityStatusesOperations, - ChildAvailabilityStatusesOperations, - ChildResourcesOperations, - Operations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The Resource Health Client. - - :ivar availability_statuses: AvailabilityStatusesOperations operations - :vartype availability_statuses: - azure.mgmt.resourcehealth.v2015_01_01.aio.operations.AvailabilityStatusesOperations - :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations - :vartype child_availability_statuses: - azure.mgmt.resourcehealth.v2015_01_01.aio.operations.ChildAvailabilityStatusesOperations - :ivar child_resources: ChildResourcesOperations operations - :vartype child_resources: - azure.mgmt.resourcehealth.v2015_01_01.aio.operations.ChildResourcesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resourcehealth.v2015_01_01.aio.operations.Operations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2015-01-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ResourceHealthMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.availability_statuses = AvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2015-01-01" - ) - self.child_availability_statuses = ChildAvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2015-01-01" - ) - self.child_resources = ChildResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2015-01-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2015-01-01") - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "ResourceHealthMgmtClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py deleted file mode 100644 index af3625f21163..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py +++ /dev/null @@ -1,25 +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 ._availability_statuses_operations import AvailabilityStatusesOperations -from ._child_availability_statuses_operations import ChildAvailabilityStatusesOperations -from ._child_resources_operations import ChildResourcesOperations -from ._operations import Operations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AvailabilityStatusesOperations", - "ChildAvailabilityStatusesOperations", - "ChildResourcesOperations", - "Operations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py deleted file mode 100644 index efb50d7cec68..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py +++ /dev/null @@ -1,428 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._availability_statuses_operations import ( - build_get_by_resource_request, - build_list_by_resource_group_request, - build_list_by_subscription_id_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.ResourceHealthMgmtClient`'s - :attr:`availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the subscription. Use the - nextLink property in the response to get the next page of availability statuses. - - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :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._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the resource group. Use the - nextLink property in the response to get the next page of availability statuses. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :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._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace_async - async def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the historical availability statuses for a single resource. Use the nextLink property in - the response to get the next page of availability status. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :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._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py deleted file mode 100644 index c6700153a4c5..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py +++ /dev/null @@ -1,226 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._child_availability_statuses_operations import build_get_by_resource_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ChildAvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.ResourceHealthMgmtClient`'s - :attr:`child_availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" - } - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the historical availability statuses for a single child resource. Use the nextLink - property in the response to get the next page of availability status. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :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._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py deleted file mode 100644 index aa9a1f327e40..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py +++ /dev/null @@ -1,153 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._child_resources_operations import build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ChildResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.ResourceHealthMgmtClient`'s - :attr:`child_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the all the children and its current health status for a parent resource. Use the - nextLink property in the response to get the next page of children current health. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support not nested parent resource type: - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :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._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py deleted file mode 100644 index 665e58e227a0..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.ResourceHealthMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list(self, **kwargs: Any) -> _models.OperationListResult: - """Lists available operations for the resourcehealth resource provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2015_01_01.models.OperationListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-01-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _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("OperationListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py deleted file mode 100644 index 4454d8321240..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py +++ /dev/null @@ -1,45 +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 ._models_py3 import AvailabilityStatus -from ._models_py3 import AvailabilityStatusListResult -from ._models_py3 import AvailabilityStatusProperties -from ._models_py3 import AvailabilityStatusPropertiesRecentlyResolvedState -from ._models_py3 import ErrorResponse -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import RecommendedAction -from ._models_py3 import ServiceImpactingEvent -from ._models_py3 import ServiceImpactingEventIncidentProperties -from ._models_py3 import ServiceImpactingEventStatus - -from ._resource_health_mgmt_client_enums import AvailabilityStateValues -from ._resource_health_mgmt_client_enums import ReasonChronicityTypes -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AvailabilityStatus", - "AvailabilityStatusListResult", - "AvailabilityStatusProperties", - "AvailabilityStatusPropertiesRecentlyResolvedState", - "ErrorResponse", - "Operation", - "OperationDisplay", - "OperationListResult", - "RecommendedAction", - "ServiceImpactingEvent", - "ServiceImpactingEventIncidentProperties", - "ServiceImpactingEventStatus", - "AvailabilityStateValues", - "ReasonChronicityTypes", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py deleted file mode 100644 index 9a0e00300ed9..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py +++ /dev/null @@ -1,622 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AvailabilityStatus(_serialization.Model): - """availabilityStatus of a resource. - - :ivar id: Azure Resource Manager Identity for the availabilityStatuses resource. - :vartype id: str - :ivar name: current. - :vartype name: str - :ivar type: Microsoft.ResourceHealth/AvailabilityStatuses. - :vartype type: str - :ivar location: Azure Resource Manager geo location of the resource. - :vartype location: str - :ivar properties: Properties of availability state. - :vartype properties: ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatusProperties - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "AvailabilityStatusProperties"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - location: Optional[str] = None, - properties: Optional["_models.AvailabilityStatusProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Azure Resource Manager Identity for the availabilityStatuses resource. - :paramtype id: str - :keyword name: current. - :paramtype name: str - :keyword type: Microsoft.ResourceHealth/AvailabilityStatuses. - :paramtype type: str - :keyword location: Azure Resource Manager geo location of the resource. - :paramtype location: str - :keyword properties: Properties of availability state. - :paramtype properties: - ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatusProperties - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.location = location - self.properties = properties - - -class AvailabilityStatusListResult(_serialization.Model): - """The List availabilityStatus operation response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The list of availabilityStatuses. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :ivar next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() with - this URI to fetch the next page of availabilityStatuses. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[AvailabilityStatus]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.AvailabilityStatus"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of availabilityStatuses. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :keyword next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() - with this URI to fetch the next page of availabilityStatuses. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Properties of availability state. - - :ivar availability_state: Availability status of the resource. Known values are: "Available", - "Unavailable", and "Unknown". - :vartype availability_state: str or - ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStateValues - :ivar summary: Summary description of the availability state. - :vartype summary: str - :ivar detailed_status: Details of the availability status. - :vartype detailed_status: str - :ivar reason_type: When the resource's availabilityState is Unavailable, it describes where the - health impacting event was originated. Examples are planned, unplanned, user initiated or an - outage etc. - :vartype reason_type: str - :ivar context: When an event is created, it can either be triggered by a customer or the - platform of the resource and this field will illustrate that. This field is connected to the - category field in this object. - :vartype context: str - :ivar category: When a context field is set to Platform, this field will reflect if the event - was planned or unplanned. If the context field does not have a value of Platform, then this - field will be ignored. - :vartype category: str - :ivar article_id: The Article Id. - :vartype article_id: str - :ivar root_cause_attribution_time: When the resource's availabilityState is Unavailable, it - provides the Timestamp for when the health impacting event was received. - :vartype root_cause_attribution_time: ~datetime.datetime - :ivar resolution_eta: When the resource's availabilityState is Unavailable and the reasonType - is not User Initiated, it provides the date and time for when the issue is expected to be - resolved. - :vartype resolution_eta: ~datetime.datetime - :ivar occured_time: Timestamp for when last change in health status occurred. - :vartype occured_time: ~datetime.datetime - :ivar reason_chronicity: Chronicity of the availability transition. Known values are: - "Transient" and "Persistent". - :vartype reason_chronicity: str or - ~azure.mgmt.resourcehealth.v2015_01_01.models.ReasonChronicityTypes - :ivar reported_time: Timestamp for when the health was last checked. - :vartype reported_time: ~datetime.datetime - :ivar is_arm_resource: flag to show if child resource need detail health. - :vartype is_arm_resource: bool - :ivar recently_resolved_state: An annotation describing a change in the availabilityState to - Available from Unavailable with a reasonType of type Unplanned. - :vartype recently_resolved_state: - ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatusPropertiesRecentlyResolvedState - :ivar recommended_actions: Lists actions the user can take based on the current - availabilityState of the resource. - :vartype recommended_actions: - list[~azure.mgmt.resourcehealth.v2015_01_01.models.RecommendedAction] - :ivar service_impacting_events: Lists the service impacting events that may be affecting the - health of the resource. - :vartype service_impacting_events: - list[~azure.mgmt.resourcehealth.v2015_01_01.models.ServiceImpactingEvent] - """ - - _attribute_map = { - "availability_state": {"key": "availabilityState", "type": "str"}, - "summary": {"key": "summary", "type": "str"}, - "detailed_status": {"key": "detailedStatus", "type": "str"}, - "reason_type": {"key": "reasonType", "type": "str"}, - "context": {"key": "context", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "article_id": {"key": "articleId", "type": "str"}, - "root_cause_attribution_time": {"key": "rootCauseAttributionTime", "type": "iso-8601"}, - "resolution_eta": {"key": "resolutionETA", "type": "iso-8601"}, - "occured_time": {"key": "occuredTime", "type": "iso-8601"}, - "reason_chronicity": {"key": "reasonChronicity", "type": "str"}, - "reported_time": {"key": "reportedTime", "type": "iso-8601"}, - "is_arm_resource": {"key": "isArmResource", "type": "bool"}, - "recently_resolved_state": { - "key": "recentlyResolvedState", - "type": "AvailabilityStatusPropertiesRecentlyResolvedState", - }, - "recommended_actions": {"key": "recommendedActions", "type": "[RecommendedAction]"}, - "service_impacting_events": {"key": "serviceImpactingEvents", "type": "[ServiceImpactingEvent]"}, - } - - def __init__( - self, - *, - availability_state: Optional[Union[str, "_models.AvailabilityStateValues"]] = None, - summary: Optional[str] = None, - detailed_status: Optional[str] = None, - reason_type: Optional[str] = None, - context: Optional[str] = None, - category: Optional[str] = None, - article_id: Optional[str] = None, - root_cause_attribution_time: Optional[datetime.datetime] = None, - resolution_eta: Optional[datetime.datetime] = None, - occured_time: Optional[datetime.datetime] = None, - reason_chronicity: Optional[Union[str, "_models.ReasonChronicityTypes"]] = None, - reported_time: Optional[datetime.datetime] = None, - is_arm_resource: Optional[bool] = None, - recently_resolved_state: Optional["_models.AvailabilityStatusPropertiesRecentlyResolvedState"] = None, - recommended_actions: Optional[List["_models.RecommendedAction"]] = None, - service_impacting_events: Optional[List["_models.ServiceImpactingEvent"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword availability_state: Availability status of the resource. Known values are: - "Available", "Unavailable", and "Unknown". - :paramtype availability_state: str or - ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStateValues - :keyword summary: Summary description of the availability state. - :paramtype summary: str - :keyword detailed_status: Details of the availability status. - :paramtype detailed_status: str - :keyword reason_type: When the resource's availabilityState is Unavailable, it describes where - the health impacting event was originated. Examples are planned, unplanned, user initiated or - an outage etc. - :paramtype reason_type: str - :keyword context: When an event is created, it can either be triggered by a customer or the - platform of the resource and this field will illustrate that. This field is connected to the - category field in this object. - :paramtype context: str - :keyword category: When a context field is set to Platform, this field will reflect if the - event was planned or unplanned. If the context field does not have a value of Platform, then - this field will be ignored. - :paramtype category: str - :keyword article_id: The Article Id. - :paramtype article_id: str - :keyword root_cause_attribution_time: When the resource's availabilityState is Unavailable, it - provides the Timestamp for when the health impacting event was received. - :paramtype root_cause_attribution_time: ~datetime.datetime - :keyword resolution_eta: When the resource's availabilityState is Unavailable and the - reasonType is not User Initiated, it provides the date and time for when the issue is expected - to be resolved. - :paramtype resolution_eta: ~datetime.datetime - :keyword occured_time: Timestamp for when last change in health status occurred. - :paramtype occured_time: ~datetime.datetime - :keyword reason_chronicity: Chronicity of the availability transition. Known values are: - "Transient" and "Persistent". - :paramtype reason_chronicity: str or - ~azure.mgmt.resourcehealth.v2015_01_01.models.ReasonChronicityTypes - :keyword reported_time: Timestamp for when the health was last checked. - :paramtype reported_time: ~datetime.datetime - :keyword is_arm_resource: flag to show if child resource need detail health. - :paramtype is_arm_resource: bool - :keyword recently_resolved_state: An annotation describing a change in the availabilityState to - Available from Unavailable with a reasonType of type Unplanned. - :paramtype recently_resolved_state: - ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatusPropertiesRecentlyResolvedState - :keyword recommended_actions: Lists actions the user can take based on the current - availabilityState of the resource. - :paramtype recommended_actions: - list[~azure.mgmt.resourcehealth.v2015_01_01.models.RecommendedAction] - :keyword service_impacting_events: Lists the service impacting events that may be affecting the - health of the resource. - :paramtype service_impacting_events: - list[~azure.mgmt.resourcehealth.v2015_01_01.models.ServiceImpactingEvent] - """ - super().__init__(**kwargs) - self.availability_state = availability_state - self.summary = summary - self.detailed_status = detailed_status - self.reason_type = reason_type - self.context = context - self.category = category - self.article_id = article_id - self.root_cause_attribution_time = root_cause_attribution_time - self.resolution_eta = resolution_eta - self.occured_time = occured_time - self.reason_chronicity = reason_chronicity - self.reported_time = reported_time - self.is_arm_resource = is_arm_resource - self.recently_resolved_state = recently_resolved_state - self.recommended_actions = recommended_actions - self.service_impacting_events = service_impacting_events - - -class AvailabilityStatusPropertiesRecentlyResolvedState(_serialization.Model): - """An annotation describing a change in the availabilityState to Available from Unavailable with a - reasonType of type Unplanned. - - :ivar unavailable_occurred_time: Timestamp for when the availabilityState changed to - Unavailable. - :vartype unavailable_occurred_time: ~datetime.datetime - :ivar resolved_time: Timestamp when the availabilityState changes to Available. - :vartype resolved_time: ~datetime.datetime - :ivar unavailability_summary: Brief description of cause of the resource becoming unavailable. - :vartype unavailability_summary: str - """ - - _attribute_map = { - "unavailable_occurred_time": {"key": "unavailableOccurredTime", "type": "iso-8601"}, - "resolved_time": {"key": "resolvedTime", "type": "iso-8601"}, - "unavailability_summary": {"key": "unavailabilitySummary", "type": "str"}, - } - - def __init__( - self, - *, - unavailable_occurred_time: Optional[datetime.datetime] = None, - resolved_time: Optional[datetime.datetime] = None, - unavailability_summary: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword unavailable_occurred_time: Timestamp for when the availabilityState changed to - Unavailable. - :paramtype unavailable_occurred_time: ~datetime.datetime - :keyword resolved_time: Timestamp when the availabilityState changes to Available. - :paramtype resolved_time: ~datetime.datetime - :keyword unavailability_summary: Brief description of cause of the resource becoming - unavailable. - :paramtype unavailability_summary: str - """ - super().__init__(**kwargs) - self.unavailable_occurred_time = unavailable_occurred_time - self.resolved_time = resolved_time - self.unavailability_summary = unavailability_summary - - -class ErrorResponse(_serialization.Model): - """Error details. - - 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 details: The error details. - :vartype details: str - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "details": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.details = None - - -class Operation(_serialization.Model): - """Operation available in the resourcehealth resource provider. - - :ivar name: Name of the operation. - :vartype name: str - :ivar display: Properties of the operation. - :vartype display: ~azure.mgmt.resourcehealth.v2015_01_01.models.OperationDisplay - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, - } - - def __init__( - self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any - ) -> None: - """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword display: Properties of the operation. - :paramtype display: ~azure.mgmt.resourcehealth.v2015_01_01.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(_serialization.Model): - """Properties of the operation. - - :ivar provider: Provider name. - :vartype provider: str - :ivar resource: Resource name. - :vartype resource: str - :ivar operation: Operation name. - :vartype operation: str - :ivar description: Description of the operation. - :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: Provider name. - :paramtype provider: str - :keyword resource: Resource name. - :paramtype resource: str - :keyword operation: Operation name. - :paramtype operation: str - :keyword description: Description of the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationListResult(_serialization.Model): - """Lists the operations response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: List of operations available in the resourcehealth resource provider. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2015_01_01.models.Operation] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - } - - def __init__(self, *, value: List["_models.Operation"], **kwargs: Any) -> None: - """ - :keyword value: List of operations available in the resourcehealth resource provider. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2015_01_01.models.Operation] - """ - super().__init__(**kwargs) - self.value = value - - -class RecommendedAction(_serialization.Model): - """Lists actions the user can take based on the current availabilityState of the resource. - - :ivar action: Recommended action. - :vartype action: str - :ivar action_url: Link to the action. - :vartype action_url: str - :ivar action_url_comment: the comment for the Action. - :vartype action_url_comment: str - :ivar action_url_text: Substring of action, it describes which text should host the action url. - :vartype action_url_text: str - """ - - _attribute_map = { - "action": {"key": "action", "type": "str"}, - "action_url": {"key": "actionUrl", "type": "str"}, - "action_url_comment": {"key": "_ActionUrl\\.Comment", "type": "str"}, - "action_url_text": {"key": "actionUrlText", "type": "str"}, - } - - def __init__( - self, - *, - action: Optional[str] = None, - action_url: Optional[str] = None, - action_url_comment: Optional[str] = None, - action_url_text: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword action: Recommended action. - :paramtype action: str - :keyword action_url: Link to the action. - :paramtype action_url: str - :keyword action_url_comment: the comment for the Action. - :paramtype action_url_comment: str - :keyword action_url_text: Substring of action, it describes which text should host the action - url. - :paramtype action_url_text: str - """ - super().__init__(**kwargs) - self.action = action - self.action_url = action_url - self.action_url_comment = action_url_comment - self.action_url_text = action_url_text - - -class ServiceImpactingEvent(_serialization.Model): - """Lists the service impacting events that may be affecting the health of the resource. - - :ivar event_start_time: Timestamp for when the event started. - :vartype event_start_time: ~datetime.datetime - :ivar event_status_last_modified_time: Timestamp for when event was submitted/detected. - :vartype event_status_last_modified_time: ~datetime.datetime - :ivar correlation_id: Correlation id for the event. - :vartype correlation_id: str - :ivar status: Status of the service impacting event. - :vartype status: ~azure.mgmt.resourcehealth.v2015_01_01.models.ServiceImpactingEventStatus - :ivar incident_properties: Properties of the service impacting event. - :vartype incident_properties: - ~azure.mgmt.resourcehealth.v2015_01_01.models.ServiceImpactingEventIncidentProperties - """ - - _attribute_map = { - "event_start_time": {"key": "eventStartTime", "type": "iso-8601"}, - "event_status_last_modified_time": {"key": "eventStatusLastModifiedTime", "type": "iso-8601"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - "status": {"key": "status", "type": "ServiceImpactingEventStatus"}, - "incident_properties": {"key": "incidentProperties", "type": "ServiceImpactingEventIncidentProperties"}, - } - - def __init__( - self, - *, - event_start_time: Optional[datetime.datetime] = None, - event_status_last_modified_time: Optional[datetime.datetime] = None, - correlation_id: Optional[str] = None, - status: Optional["_models.ServiceImpactingEventStatus"] = None, - incident_properties: Optional["_models.ServiceImpactingEventIncidentProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword event_start_time: Timestamp for when the event started. - :paramtype event_start_time: ~datetime.datetime - :keyword event_status_last_modified_time: Timestamp for when event was submitted/detected. - :paramtype event_status_last_modified_time: ~datetime.datetime - :keyword correlation_id: Correlation id for the event. - :paramtype correlation_id: str - :keyword status: Status of the service impacting event. - :paramtype status: ~azure.mgmt.resourcehealth.v2015_01_01.models.ServiceImpactingEventStatus - :keyword incident_properties: Properties of the service impacting event. - :paramtype incident_properties: - ~azure.mgmt.resourcehealth.v2015_01_01.models.ServiceImpactingEventIncidentProperties - """ - super().__init__(**kwargs) - self.event_start_time = event_start_time - self.event_status_last_modified_time = event_status_last_modified_time - self.correlation_id = correlation_id - self.status = status - self.incident_properties = incident_properties - - -class ServiceImpactingEventIncidentProperties(_serialization.Model): - """Properties of the service impacting event. - - :ivar title: Title of the incident. - :vartype title: str - :ivar service: Service impacted by the event. - :vartype service: str - :ivar region: Region impacted by the event. - :vartype region: str - :ivar incident_type: Type of Event. - :vartype incident_type: str - """ - - _attribute_map = { - "title": {"key": "title", "type": "str"}, - "service": {"key": "service", "type": "str"}, - "region": {"key": "region", "type": "str"}, - "incident_type": {"key": "incidentType", "type": "str"}, - } - - def __init__( - self, - *, - title: Optional[str] = None, - service: Optional[str] = None, - region: Optional[str] = None, - incident_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword title: Title of the incident. - :paramtype title: str - :keyword service: Service impacted by the event. - :paramtype service: str - :keyword region: Region impacted by the event. - :paramtype region: str - :keyword incident_type: Type of Event. - :paramtype incident_type: str - """ - super().__init__(**kwargs) - self.title = title - self.service = service - self.region = region - self.incident_type = incident_type - - -class ServiceImpactingEventStatus(_serialization.Model): - """Status of the service impacting event. - - :ivar value: Current status of the event. - :vartype value: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Current status of the event. - :paramtype value: str - """ - super().__init__(**kwargs) - self.value = value diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_resource_health_mgmt_client_enums.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_resource_health_mgmt_client_enums.py deleted file mode 100644 index a230347284c1..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_resource_health_mgmt_client_enums.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class AvailabilityStateValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Availability status of the resource.""" - - AVAILABLE = "Available" - UNAVAILABLE = "Unavailable" - UNKNOWN = "Unknown" - - -class ReasonChronicityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Chronicity of the availability transition.""" - - TRANSIENT = "Transient" - PERSISTENT = "Persistent" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py deleted file mode 100644 index af3625f21163..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py +++ /dev/null @@ -1,25 +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 ._availability_statuses_operations import AvailabilityStatusesOperations -from ._child_availability_statuses_operations import ChildAvailabilityStatusesOperations -from ._child_resources_operations import ChildResourcesOperations -from ._operations import Operations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AvailabilityStatusesOperations", - "ChildAvailabilityStatusesOperations", - "ChildResourcesOperations", - "Operations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py deleted file mode 100644 index 657c42689a88..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py +++ /dev/null @@ -1,556 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_id_request( - subscription_id: str, *, filter: Optional[str] = None, expand: 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", "2015-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "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, - *, - filter: Optional[str] = None, - expand: 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", "2015-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_by_resource_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2015-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2015-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.ResourceHealthMgmtClient`'s - :attr:`availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the subscription. Use the - nextLink property in the response to get the next page of availability statuses. - - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :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._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the resource group. Use the - nextLink property in the response to get the next page of availability statuses. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :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._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace - def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the historical availability statuses for a single resource. Use the nextLink property in - the response to get the next page of availability status. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :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._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py deleted file mode 100644 index ca7a992d34eb..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py +++ /dev/null @@ -1,290 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_by_resource_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2015-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" - ) - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2015-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ChildAvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.ResourceHealthMgmtClient`'s - :attr:`child_availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" - } - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the historical availability statuses for a single child resource. Use the nextLink - property in the response to get the next page of availability status. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] - :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._api_version or "2015-01-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/py.typed b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py deleted file mode 100644 index f1e7a4fdd09e..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py +++ /dev/null @@ -1,26 +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 ._resource_health_mgmt_client import ResourceHealthMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ResourceHealthMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py deleted file mode 100644 index 2a6c7a41ebd8..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py +++ /dev/null @@ -1,67 +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 typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ResourceHealthMgmtClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2018-07-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json deleted file mode 100644 index a19822ee1888..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "chosen_version": "2018-07-01", - "total_api_version_list": ["2018-07-01"], - "client": { - "name": "ResourceHealthMgmtClient", - "filename": "_resource_health_mgmt_client", - "description": "The Resource Health Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "events": "EventsOperations", - "availability_statuses": "AvailabilityStatusesOperations", - "operations": "Operations", - "emerging_issues": "EmergingIssuesOperations", - "metadata": "MetadataOperations" - } -} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_resource_health_mgmt_client.py deleted file mode 100644 index 7c02652f5bac..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_resource_health_mgmt_client.py +++ /dev/null @@ -1,114 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ResourceHealthMgmtClientConfiguration -from .operations import ( - AvailabilityStatusesOperations, - EmergingIssuesOperations, - EventsOperations, - MetadataOperations, - Operations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The Resource Health Client. - - :ivar events: EventsOperations operations - :vartype events: azure.mgmt.resourcehealth.v2018_07_01.operations.EventsOperations - :ivar availability_statuses: AvailabilityStatusesOperations operations - :vartype availability_statuses: - azure.mgmt.resourcehealth.v2018_07_01.operations.AvailabilityStatusesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resourcehealth.v2018_07_01.operations.Operations - :ivar emerging_issues: EmergingIssuesOperations operations - :vartype emerging_issues: - azure.mgmt.resourcehealth.v2018_07_01.operations.EmergingIssuesOperations - :ivar metadata: MetadataOperations operations - :vartype metadata: azure.mgmt.resourcehealth.v2018_07_01.operations.MetadataOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2018-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ResourceHealthMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize, "2018-07-01") - self.availability_statuses = AvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-07-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2018-07-01") - self.emerging_issues = EmergingIssuesOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-07-01" - ) - self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize, "2018-07-01") - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "ResourceHealthMgmtClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_vendor.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py deleted file mode 100644 index 9cf33092d41b..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b5" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py deleted file mode 100644 index d95ad182aa0f..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py +++ /dev/null @@ -1,23 +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 ._resource_health_mgmt_client import ResourceHealthMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ResourceHealthMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py deleted file mode 100644 index 1252777a1917..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py +++ /dev/null @@ -1,67 +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 typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ResourceHealthMgmtClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2018-07-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_resource_health_mgmt_client.py deleted file mode 100644 index 47dae5690a43..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_resource_health_mgmt_client.py +++ /dev/null @@ -1,114 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ResourceHealthMgmtClientConfiguration -from .operations import ( - AvailabilityStatusesOperations, - EmergingIssuesOperations, - EventsOperations, - MetadataOperations, - Operations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The Resource Health Client. - - :ivar events: EventsOperations operations - :vartype events: azure.mgmt.resourcehealth.v2018_07_01.aio.operations.EventsOperations - :ivar availability_statuses: AvailabilityStatusesOperations operations - :vartype availability_statuses: - azure.mgmt.resourcehealth.v2018_07_01.aio.operations.AvailabilityStatusesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resourcehealth.v2018_07_01.aio.operations.Operations - :ivar emerging_issues: EmergingIssuesOperations operations - :vartype emerging_issues: - azure.mgmt.resourcehealth.v2018_07_01.aio.operations.EmergingIssuesOperations - :ivar metadata: MetadataOperations operations - :vartype metadata: azure.mgmt.resourcehealth.v2018_07_01.aio.operations.MetadataOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2018-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ResourceHealthMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize, "2018-07-01") - self.availability_statuses = AvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-07-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2018-07-01") - self.emerging_issues = EmergingIssuesOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-07-01" - ) - self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize, "2018-07-01") - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "ResourceHealthMgmtClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py deleted file mode 100644 index 4d84024fc0a6..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py +++ /dev/null @@ -1,27 +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 ._events_operations import EventsOperations -from ._availability_statuses_operations import AvailabilityStatusesOperations -from ._operations import Operations -from ._emerging_issues_operations import EmergingIssuesOperations -from ._metadata_operations import MetadataOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EventsOperations", - "AvailabilityStatusesOperations", - "Operations", - "EmergingIssuesOperations", - "MetadataOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py deleted file mode 100644 index daff89368b4c..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py +++ /dev/null @@ -1,433 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._availability_statuses_operations import ( - build_get_by_resource_request, - build_list_by_resource_group_request, - build_list_by_subscription_id_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s - :attr:`availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the subscription. - - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the resource group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace_async - async def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists all historical availability transitions and impacting events for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py deleted file mode 100644 index 0bd25f6747c6..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py +++ /dev/null @@ -1,193 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._emerging_issues_operations import build_get_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EmergingIssuesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s - :attr:`emerging_issues` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.EmergingIssuesGetResult: - """Gets Azure services' emerging issues. - - :param issue_name: The name of the emerging issue. "default" Required. - :type issue_name: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.Enum8 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmergingIssuesGetResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2018_07_01.models.EmergingIssuesGetResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) - cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) - - request = build_get_request( - issue_name=issue_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult"]: - """Lists Azure services' emerging issues. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EmergingIssuesGetResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.EmergingIssuesGetResult] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("EmergingIssueListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py deleted file mode 100644 index d559f9526c71..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py +++ /dev/null @@ -1,263 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._events_operations import ( - build_list_by_single_resource_request, - build_list_by_subscription_id_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EventsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s - :attr:`events` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, - filter: Optional[str] = None, - query_start_time: Optional[str] = None, - view: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.Event"]: - """Lists current service health events in the subscription. - - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :param view: setting view=full expands the article parameters. Default value is None. - :type view: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.Event] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - query_start_time=query_start_time, - view=view, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" - } - - @distributed_trace - def list_by_single_resource( - self, resource_uri: str, filter: Optional[str] = None, view: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Event"]: - """Lists current service health events for given resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param view: setting view=full expands the article parameters. Default value is None. - :type view: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.Event] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_single_resource_request( - resource_uri=resource_uri, - filter=filter, - view=view, - api_version=api_version, - template_url=self.list_by_single_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py deleted file mode 100644 index cff572f1f903..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py +++ /dev/null @@ -1,107 +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 ._models_py3 import AvailabilityStatus -from ._models_py3 import AvailabilityStatusListResult -from ._models_py3 import AvailabilityStatusProperties -from ._models_py3 import AvailabilityStatusPropertiesRecentlyResolved -from ._models_py3 import EmergingIssueImpact -from ._models_py3 import EmergingIssueListResult -from ._models_py3 import EmergingIssuesGetResult -from ._models_py3 import ErrorResponse -from ._models_py3 import Event -from ._models_py3 import EventPropertiesArticle -from ._models_py3 import EventPropertiesRecommendedActions -from ._models_py3 import EventPropertiesRecommendedActionsItem -from ._models_py3 import Events -from ._models_py3 import Faq -from ._models_py3 import Impact -from ._models_py3 import ImpactedRegion -from ._models_py3 import ImpactedServiceRegion -from ._models_py3 import Link -from ._models_py3 import LinkDisplayText -from ._models_py3 import MetadataEntity -from ._models_py3 import MetadataEntityListResult -from ._models_py3 import MetadataSupportedValueDetail -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import RecommendedAction -from ._models_py3 import Resource -from ._models_py3 import ServiceImpactingEvent -from ._models_py3 import ServiceImpactingEventIncidentProperties -from ._models_py3 import ServiceImpactingEventStatus -from ._models_py3 import StatusActiveEvent -from ._models_py3 import StatusBanner -from ._models_py3 import Update - -from ._resource_health_mgmt_client_enums import AvailabilityStateValues -from ._resource_health_mgmt_client_enums import Enum8 -from ._resource_health_mgmt_client_enums import EventLevelValues -from ._resource_health_mgmt_client_enums import EventSourceValues -from ._resource_health_mgmt_client_enums import EventStatusValues -from ._resource_health_mgmt_client_enums import EventTypeValues -from ._resource_health_mgmt_client_enums import LevelValues -from ._resource_health_mgmt_client_enums import LinkTypeValues -from ._resource_health_mgmt_client_enums import ReasonChronicityTypes -from ._resource_health_mgmt_client_enums import Scenario -from ._resource_health_mgmt_client_enums import SeverityValues -from ._resource_health_mgmt_client_enums import StageValues -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AvailabilityStatus", - "AvailabilityStatusListResult", - "AvailabilityStatusProperties", - "AvailabilityStatusPropertiesRecentlyResolved", - "EmergingIssueImpact", - "EmergingIssueListResult", - "EmergingIssuesGetResult", - "ErrorResponse", - "Event", - "EventPropertiesArticle", - "EventPropertiesRecommendedActions", - "EventPropertiesRecommendedActionsItem", - "Events", - "Faq", - "Impact", - "ImpactedRegion", - "ImpactedServiceRegion", - "Link", - "LinkDisplayText", - "MetadataEntity", - "MetadataEntityListResult", - "MetadataSupportedValueDetail", - "Operation", - "OperationDisplay", - "OperationListResult", - "RecommendedAction", - "Resource", - "ServiceImpactingEvent", - "ServiceImpactingEventIncidentProperties", - "ServiceImpactingEventStatus", - "StatusActiveEvent", - "StatusBanner", - "Update", - "AvailabilityStateValues", - "Enum8", - "EventLevelValues", - "EventSourceValues", - "EventStatusValues", - "EventTypeValues", - "LevelValues", - "LinkTypeValues", - "ReasonChronicityTypes", - "Scenario", - "SeverityValues", - "StageValues", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py deleted file mode 100644 index aa775b795005..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py +++ /dev/null @@ -1,1732 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -import sys -from typing import Any, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AvailabilityStatus(_serialization.Model): - """availabilityStatus of a resource. - - :ivar id: Azure Resource Manager Identity for the availabilityStatuses resource. - :vartype id: str - :ivar name: current. - :vartype name: str - :ivar type: Microsoft.ResourceHealth/AvailabilityStatuses. - :vartype type: str - :ivar location: Azure Resource Manager geo location of the resource. - :vartype location: str - :ivar properties: Properties of availability state. - :vartype properties: ~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatusProperties - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "AvailabilityStatusProperties"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - location: Optional[str] = None, - properties: Optional["_models.AvailabilityStatusProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Azure Resource Manager Identity for the availabilityStatuses resource. - :paramtype id: str - :keyword name: current. - :paramtype name: str - :keyword type: Microsoft.ResourceHealth/AvailabilityStatuses. - :paramtype type: str - :keyword location: Azure Resource Manager geo location of the resource. - :paramtype location: str - :keyword properties: Properties of availability state. - :paramtype properties: - ~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatusProperties - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.location = location - self.properties = properties - - -class AvailabilityStatusListResult(_serialization.Model): - """The List availabilityStatus operation response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The list of availabilityStatuses. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus] - :ivar next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() with - this URI to fetch the next page of availabilityStatuses. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[AvailabilityStatus]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.AvailabilityStatus"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of availabilityStatuses. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus] - :keyword next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() - with this URI to fetch the next page of availabilityStatuses. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Properties of availability state. - - :ivar availability_state: Availability status of the resource. When it is null, this - availabilityStatus object represents an availability impacting event. Known values are: - "Available", "Unavailable", "Degraded", and "Unknown". - :vartype availability_state: str or - ~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStateValues - :ivar summary: Summary description of the availability status. - :vartype summary: str - :ivar detailed_status: Details of the availability status. - :vartype detailed_status: str - :ivar reason_type: When the resource's availabilityState is Unavailable, it describes where the - health impacting event was originated. Examples are planned, unplanned, user initiated or an - outage etc. - :vartype reason_type: str - :ivar context: When an event is created, it can either be triggered by a customer or the - platform of the resource and this field will illustrate that. This field is connected to the - category field in this object. - :vartype context: str - :ivar category: When a context field is set to Platform, this field will reflect if the event - was planned or unplanned. If the context field does not have a value of Platform, then this - field will be ignored. - :vartype category: str - :ivar article_id: The Article Id. - :vartype article_id: str - :ivar root_cause_attribution_time: When the resource's availabilityState is Unavailable, it - provides the Timestamp for when the health impacting event was received. - :vartype root_cause_attribution_time: ~datetime.datetime - :ivar health_event_type: In case of an availability impacting event, it describes when the - health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. - :vartype health_event_type: str - :ivar health_event_cause: In case of an availability impacting event, it describes where the - health impacting event was originated. Examples are PlatformInitiated, UserInitiated etc. - :vartype health_event_cause: str - :ivar health_event_category: In case of an availability impacting event, it describes the - category of a PlatformInitiated health impacting event. Examples are Planned, Unplanned etc. - :vartype health_event_category: str - :ivar health_event_id: It is a unique Id that identifies the event. - :vartype health_event_id: str - :ivar resolution_eta: When the resource's availabilityState is Unavailable and the reasonType - is not User Initiated, it provides the date and time for when the issue is expected to be - resolved. - :vartype resolution_eta: ~datetime.datetime - :ivar occurred_time: Timestamp for when last change in health status occurred. - :vartype occurred_time: ~datetime.datetime - :ivar reason_chronicity: Chronicity of the availability transition. Known values are: - "Transient" and "Persistent". - :vartype reason_chronicity: str or - ~azure.mgmt.resourcehealth.v2018_07_01.models.ReasonChronicityTypes - :ivar reported_time: Timestamp for when the health was last checked. - :vartype reported_time: ~datetime.datetime - :ivar recently_resolved: An annotation describing a change in the availabilityState to - Available from Unavailable with a reasonType of type Unplanned. - :vartype recently_resolved: - ~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatusPropertiesRecentlyResolved - :ivar recommended_actions: Lists actions the user can take based on the current - availabilityState of the resource. - :vartype recommended_actions: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.RecommendedAction] - :ivar service_impacting_events: Lists the service impacting events that may be affecting the - health of the resource. - :vartype service_impacting_events: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.ServiceImpactingEvent] - """ - - _attribute_map = { - "availability_state": {"key": "availabilityState", "type": "str"}, - "summary": {"key": "summary", "type": "str"}, - "detailed_status": {"key": "detailedStatus", "type": "str"}, - "reason_type": {"key": "reasonType", "type": "str"}, - "context": {"key": "context", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "article_id": {"key": "articleId", "type": "str"}, - "root_cause_attribution_time": {"key": "rootCauseAttributionTime", "type": "iso-8601"}, - "health_event_type": {"key": "healthEventType", "type": "str"}, - "health_event_cause": {"key": "healthEventCause", "type": "str"}, - "health_event_category": {"key": "healthEventCategory", "type": "str"}, - "health_event_id": {"key": "healthEventId", "type": "str"}, - "resolution_eta": {"key": "resolutionETA", "type": "iso-8601"}, - "occurred_time": {"key": "occurredTime", "type": "iso-8601"}, - "reason_chronicity": {"key": "reasonChronicity", "type": "str"}, - "reported_time": {"key": "reportedTime", "type": "iso-8601"}, - "recently_resolved": {"key": "recentlyResolved", "type": "AvailabilityStatusPropertiesRecentlyResolved"}, - "recommended_actions": {"key": "recommendedActions", "type": "[RecommendedAction]"}, - "service_impacting_events": {"key": "serviceImpactingEvents", "type": "[ServiceImpactingEvent]"}, - } - - def __init__( - self, - *, - availability_state: Optional[Union[str, "_models.AvailabilityStateValues"]] = None, - summary: Optional[str] = None, - detailed_status: Optional[str] = None, - reason_type: Optional[str] = None, - context: Optional[str] = None, - category: Optional[str] = None, - article_id: Optional[str] = None, - root_cause_attribution_time: Optional[datetime.datetime] = None, - health_event_type: Optional[str] = None, - health_event_cause: Optional[str] = None, - health_event_category: Optional[str] = None, - health_event_id: Optional[str] = None, - resolution_eta: Optional[datetime.datetime] = None, - occurred_time: Optional[datetime.datetime] = None, - reason_chronicity: Optional[Union[str, "_models.ReasonChronicityTypes"]] = None, - reported_time: Optional[datetime.datetime] = None, - recently_resolved: Optional["_models.AvailabilityStatusPropertiesRecentlyResolved"] = None, - recommended_actions: Optional[List["_models.RecommendedAction"]] = None, - service_impacting_events: Optional[List["_models.ServiceImpactingEvent"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword availability_state: Availability status of the resource. When it is null, this - availabilityStatus object represents an availability impacting event. Known values are: - "Available", "Unavailable", "Degraded", and "Unknown". - :paramtype availability_state: str or - ~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStateValues - :keyword summary: Summary description of the availability status. - :paramtype summary: str - :keyword detailed_status: Details of the availability status. - :paramtype detailed_status: str - :keyword reason_type: When the resource's availabilityState is Unavailable, it describes where - the health impacting event was originated. Examples are planned, unplanned, user initiated or - an outage etc. - :paramtype reason_type: str - :keyword context: When an event is created, it can either be triggered by a customer or the - platform of the resource and this field will illustrate that. This field is connected to the - category field in this object. - :paramtype context: str - :keyword category: When a context field is set to Platform, this field will reflect if the - event was planned or unplanned. If the context field does not have a value of Platform, then - this field will be ignored. - :paramtype category: str - :keyword article_id: The Article Id. - :paramtype article_id: str - :keyword root_cause_attribution_time: When the resource's availabilityState is Unavailable, it - provides the Timestamp for when the health impacting event was received. - :paramtype root_cause_attribution_time: ~datetime.datetime - :keyword health_event_type: In case of an availability impacting event, it describes when the - health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. - :paramtype health_event_type: str - :keyword health_event_cause: In case of an availability impacting event, it describes where the - health impacting event was originated. Examples are PlatformInitiated, UserInitiated etc. - :paramtype health_event_cause: str - :keyword health_event_category: In case of an availability impacting event, it describes the - category of a PlatformInitiated health impacting event. Examples are Planned, Unplanned etc. - :paramtype health_event_category: str - :keyword health_event_id: It is a unique Id that identifies the event. - :paramtype health_event_id: str - :keyword resolution_eta: When the resource's availabilityState is Unavailable and the - reasonType is not User Initiated, it provides the date and time for when the issue is expected - to be resolved. - :paramtype resolution_eta: ~datetime.datetime - :keyword occurred_time: Timestamp for when last change in health status occurred. - :paramtype occurred_time: ~datetime.datetime - :keyword reason_chronicity: Chronicity of the availability transition. Known values are: - "Transient" and "Persistent". - :paramtype reason_chronicity: str or - ~azure.mgmt.resourcehealth.v2018_07_01.models.ReasonChronicityTypes - :keyword reported_time: Timestamp for when the health was last checked. - :paramtype reported_time: ~datetime.datetime - :keyword recently_resolved: An annotation describing a change in the availabilityState to - Available from Unavailable with a reasonType of type Unplanned. - :paramtype recently_resolved: - ~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatusPropertiesRecentlyResolved - :keyword recommended_actions: Lists actions the user can take based on the current - availabilityState of the resource. - :paramtype recommended_actions: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.RecommendedAction] - :keyword service_impacting_events: Lists the service impacting events that may be affecting the - health of the resource. - :paramtype service_impacting_events: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.ServiceImpactingEvent] - """ - super().__init__(**kwargs) - self.availability_state = availability_state - self.summary = summary - self.detailed_status = detailed_status - self.reason_type = reason_type - self.context = context - self.category = category - self.article_id = article_id - self.root_cause_attribution_time = root_cause_attribution_time - self.health_event_type = health_event_type - self.health_event_cause = health_event_cause - self.health_event_category = health_event_category - self.health_event_id = health_event_id - self.resolution_eta = resolution_eta - self.occurred_time = occurred_time - self.reason_chronicity = reason_chronicity - self.reported_time = reported_time - self.recently_resolved = recently_resolved - self.recommended_actions = recommended_actions - self.service_impacting_events = service_impacting_events - - -class AvailabilityStatusPropertiesRecentlyResolved(_serialization.Model): - """An annotation describing a change in the availabilityState to Available from Unavailable with a - reasonType of type Unplanned. - - :ivar unavailable_occurred_time: Timestamp for when the availabilityState changed to - Unavailable. - :vartype unavailable_occurred_time: ~datetime.datetime - :ivar resolved_time: Timestamp when the availabilityState changes to Available. - :vartype resolved_time: ~datetime.datetime - :ivar unavailability_summary: Brief description of cause of the resource becoming unavailable. - :vartype unavailability_summary: str - """ - - _attribute_map = { - "unavailable_occurred_time": {"key": "unavailableOccurredTime", "type": "iso-8601"}, - "resolved_time": {"key": "resolvedTime", "type": "iso-8601"}, - "unavailability_summary": {"key": "unavailabilitySummary", "type": "str"}, - } - - def __init__( - self, - *, - unavailable_occurred_time: Optional[datetime.datetime] = None, - resolved_time: Optional[datetime.datetime] = None, - unavailability_summary: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword unavailable_occurred_time: Timestamp for when the availabilityState changed to - Unavailable. - :paramtype unavailable_occurred_time: ~datetime.datetime - :keyword resolved_time: Timestamp when the availabilityState changes to Available. - :paramtype resolved_time: ~datetime.datetime - :keyword unavailability_summary: Brief description of cause of the resource becoming - unavailable. - :paramtype unavailability_summary: str - """ - super().__init__(**kwargs) - self.unavailable_occurred_time = unavailable_occurred_time - self.resolved_time = resolved_time - self.unavailability_summary = unavailability_summary - - -class EmergingIssueImpact(_serialization.Model): - """Object of the emerging issue impact on services and regions. - - :ivar id: The impacted service id. - :vartype id: str - :ivar name: The impacted service name. - :vartype name: str - :ivar regions: The list of impacted regions for corresponding emerging issues. - :vartype regions: list[~azure.mgmt.resourcehealth.v2018_07_01.models.ImpactedRegion] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "regions": {"key": "regions", "type": "[ImpactedRegion]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - regions: Optional[List["_models.ImpactedRegion"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The impacted service id. - :paramtype id: str - :keyword name: The impacted service name. - :paramtype name: str - :keyword regions: The list of impacted regions for corresponding emerging issues. - :paramtype regions: list[~azure.mgmt.resourcehealth.v2018_07_01.models.ImpactedRegion] - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.regions = regions - - -class EmergingIssueListResult(_serialization.Model): - """The list of emerging issues. - - :ivar value: The list of emerging issues. - :vartype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.EmergingIssuesGetResult] - :ivar next_link: The link used to get the next page of emerging issues. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[EmergingIssuesGetResult]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.EmergingIssuesGetResult"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of emerging issues. - :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.EmergingIssuesGetResult] - :keyword next_link: The link used to get the next page of emerging issues. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. 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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class EmergingIssuesGetResult(Resource): - """The Get EmergingIssues operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar refresh_timestamp: Timestamp for when last time refreshed for ongoing emerging issue. - :vartype refresh_timestamp: ~datetime.datetime - :ivar status_banners: The list of emerging issues of banner type. - :vartype status_banners: list[~azure.mgmt.resourcehealth.v2018_07_01.models.StatusBanner] - :ivar status_active_events: The list of emerging issues of active event type. - :vartype status_active_events: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.StatusActiveEvent] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "refresh_timestamp": {"key": "properties.refreshTimestamp", "type": "iso-8601"}, - "status_banners": {"key": "properties.statusBanners", "type": "[StatusBanner]"}, - "status_active_events": {"key": "properties.statusActiveEvents", "type": "[StatusActiveEvent]"}, - } - - def __init__( - self, - *, - refresh_timestamp: Optional[datetime.datetime] = None, - status_banners: Optional[List["_models.StatusBanner"]] = None, - status_active_events: Optional[List["_models.StatusActiveEvent"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword refresh_timestamp: Timestamp for when last time refreshed for ongoing emerging issue. - :paramtype refresh_timestamp: ~datetime.datetime - :keyword status_banners: The list of emerging issues of banner type. - :paramtype status_banners: list[~azure.mgmt.resourcehealth.v2018_07_01.models.StatusBanner] - :keyword status_active_events: The list of emerging issues of active event type. - :paramtype status_active_events: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.StatusActiveEvent] - """ - super().__init__(**kwargs) - self.refresh_timestamp = refresh_timestamp - self.status_banners = status_banners - self.status_active_events = status_active_events - - -class ErrorResponse(_serialization.Model): - """Error details. - - 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 details: The error details. - :vartype details: str - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "details": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.details = None - - -class Event(Resource): # pylint: disable=too-many-instance-attributes - """Service health event. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar event_type: Type of event. Known values are: "ServiceIssue", "PlannedMaintenance", - "HealthAdvisory", "RCA", "EmergingIssues", and "SecurityAdvisory". - :vartype event_type: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventTypeValues - :ivar event_source: Source of event. Known values are: "ResourceHealth" and "ServiceHealth". - :vartype event_source: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventSourceValues - :ivar status: Current status of event. Known values are: "Active" and "Resolved". - :vartype status: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventStatusValues - :ivar title: Title text of event. - :vartype title: str - :ivar summary: Summary text of event. - :vartype summary: str - :ivar header: Header text of event. - :vartype header: str - :ivar level: Level of insight. Known values are: "Critical" and "Warning". - :vartype level: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.LevelValues - :ivar event_level: Level of event. Known values are: "Critical", "Error", "Warning", and - "Informational". - :vartype event_level: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventLevelValues - :ivar reason: The reason for the Incident. - :vartype reason: str - :ivar article: Article of event. - :vartype article: ~azure.mgmt.resourcehealth.v2018_07_01.models.EventPropertiesArticle - :ivar links: Useful links of event. - :vartype links: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Link] - :ivar impact_start_time: It provides the Timestamp for when the health impacting event started. - :vartype impact_start_time: ~datetime.datetime - :ivar impact_mitigation_time: It provides the Timestamp for when the health impacting event - resolved. - :vartype impact_mitigation_time: ~datetime.datetime - :ivar impact: List services impacted by the service health event. - :vartype impact: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Impact] - :ivar recommended_actions: Recommended actions of event. - :vartype recommended_actions: - ~azure.mgmt.resourcehealth.v2018_07_01.models.EventPropertiesRecommendedActions - :ivar faqs: Frequently asked questions for the service health event. - :vartype faqs: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Faq] - :ivar is_hir: It provides information if the event is High incident rate event or not. - :vartype is_hir: bool - :ivar enable_microsoft_support: Tells if we want to enable or disable Microsoft Support for - this event. - :vartype enable_microsoft_support: bool - :ivar description: Contains the communication message for the event, that could include - summary, root cause and other details. - :vartype description: str - :ivar platform_initiated: Is true if the event is platform initiated. - :vartype platform_initiated: bool - :ivar enable_chat_with_us: Tells if we want to enable or disable Microsoft Support for this - event. - :vartype enable_chat_with_us: bool - :ivar priority: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. - Service issue events have higher priority followed by planned maintenance and health advisory. - Critical events have higher priority followed by error, warning and informational. Furthermore, - active events have higher priority than resolved. - :vartype priority: int - :ivar last_update_time: It provides the Timestamp for when the health impacting event was last - updated. - :vartype last_update_time: ~datetime.datetime - :ivar hir_stage: Stage for HIR Document. - :vartype hir_stage: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "event_type": {"key": "properties.eventType", "type": "str"}, - "event_source": {"key": "properties.eventSource", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "title": {"key": "properties.title", "type": "str"}, - "summary": {"key": "properties.summary", "type": "str"}, - "header": {"key": "properties.header", "type": "str"}, - "level": {"key": "properties.level", "type": "str"}, - "event_level": {"key": "properties.eventLevel", "type": "str"}, - "reason": {"key": "properties.reason", "type": "str"}, - "article": {"key": "properties.article", "type": "EventPropertiesArticle"}, - "links": {"key": "properties.links", "type": "[Link]"}, - "impact_start_time": {"key": "properties.impactStartTime", "type": "iso-8601"}, - "impact_mitigation_time": {"key": "properties.impactMitigationTime", "type": "iso-8601"}, - "impact": {"key": "properties.impact", "type": "[Impact]"}, - "recommended_actions": {"key": "properties.recommendedActions", "type": "EventPropertiesRecommendedActions"}, - "faqs": {"key": "properties.faqs", "type": "[Faq]"}, - "is_hir": {"key": "properties.isHIR", "type": "bool"}, - "enable_microsoft_support": {"key": "properties.enableMicrosoftSupport", "type": "bool"}, - "description": {"key": "properties.description", "type": "str"}, - "platform_initiated": {"key": "properties.platformInitiated", "type": "bool"}, - "enable_chat_with_us": {"key": "properties.enableChatWithUs", "type": "bool"}, - "priority": {"key": "properties.priority", "type": "int"}, - "last_update_time": {"key": "properties.lastUpdateTime", "type": "iso-8601"}, - "hir_stage": {"key": "properties.hirStage", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - event_type: Optional[Union[str, "_models.EventTypeValues"]] = None, - event_source: Optional[Union[str, "_models.EventSourceValues"]] = None, - status: Optional[Union[str, "_models.EventStatusValues"]] = None, - title: Optional[str] = None, - summary: Optional[str] = None, - header: Optional[str] = None, - level: Optional[Union[str, "_models.LevelValues"]] = None, - event_level: Optional[Union[str, "_models.EventLevelValues"]] = None, - reason: Optional[str] = None, - article: Optional["_models.EventPropertiesArticle"] = None, - links: Optional[List["_models.Link"]] = None, - impact_start_time: Optional[datetime.datetime] = None, - impact_mitigation_time: Optional[datetime.datetime] = None, - impact: Optional[List["_models.Impact"]] = None, - recommended_actions: Optional["_models.EventPropertiesRecommendedActions"] = None, - faqs: Optional[List["_models.Faq"]] = None, - is_hir: Optional[bool] = None, - enable_microsoft_support: Optional[bool] = None, - description: Optional[str] = None, - platform_initiated: Optional[bool] = None, - enable_chat_with_us: Optional[bool] = None, - priority: Optional[int] = None, - last_update_time: Optional[datetime.datetime] = None, - hir_stage: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword event_type: Type of event. Known values are: "ServiceIssue", "PlannedMaintenance", - "HealthAdvisory", "RCA", "EmergingIssues", and "SecurityAdvisory". - :paramtype event_type: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventTypeValues - :keyword event_source: Source of event. Known values are: "ResourceHealth" and "ServiceHealth". - :paramtype event_source: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventSourceValues - :keyword status: Current status of event. Known values are: "Active" and "Resolved". - :paramtype status: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventStatusValues - :keyword title: Title text of event. - :paramtype title: str - :keyword summary: Summary text of event. - :paramtype summary: str - :keyword header: Header text of event. - :paramtype header: str - :keyword level: Level of insight. Known values are: "Critical" and "Warning". - :paramtype level: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.LevelValues - :keyword event_level: Level of event. Known values are: "Critical", "Error", "Warning", and - "Informational". - :paramtype event_level: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventLevelValues - :keyword reason: The reason for the Incident. - :paramtype reason: str - :keyword article: Article of event. - :paramtype article: ~azure.mgmt.resourcehealth.v2018_07_01.models.EventPropertiesArticle - :keyword links: Useful links of event. - :paramtype links: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Link] - :keyword impact_start_time: It provides the Timestamp for when the health impacting event - started. - :paramtype impact_start_time: ~datetime.datetime - :keyword impact_mitigation_time: It provides the Timestamp for when the health impacting event - resolved. - :paramtype impact_mitigation_time: ~datetime.datetime - :keyword impact: List services impacted by the service health event. - :paramtype impact: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Impact] - :keyword recommended_actions: Recommended actions of event. - :paramtype recommended_actions: - ~azure.mgmt.resourcehealth.v2018_07_01.models.EventPropertiesRecommendedActions - :keyword faqs: Frequently asked questions for the service health event. - :paramtype faqs: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Faq] - :keyword is_hir: It provides information if the event is High incident rate event or not. - :paramtype is_hir: bool - :keyword enable_microsoft_support: Tells if we want to enable or disable Microsoft Support for - this event. - :paramtype enable_microsoft_support: bool - :keyword description: Contains the communication message for the event, that could include - summary, root cause and other details. - :paramtype description: str - :keyword platform_initiated: Is true if the event is platform initiated. - :paramtype platform_initiated: bool - :keyword enable_chat_with_us: Tells if we want to enable or disable Microsoft Support for this - event. - :paramtype enable_chat_with_us: bool - :keyword priority: Priority level of the event. Has value from 0 to 23. 0 is the highest - priority. Service issue events have higher priority followed by planned maintenance and health - advisory. Critical events have higher priority followed by error, warning and informational. - Furthermore, active events have higher priority than resolved. - :paramtype priority: int - :keyword last_update_time: It provides the Timestamp for when the health impacting event was - last updated. - :paramtype last_update_time: ~datetime.datetime - :keyword hir_stage: Stage for HIR Document. - :paramtype hir_stage: str - """ - super().__init__(**kwargs) - self.event_type = event_type - self.event_source = event_source - self.status = status - self.title = title - self.summary = summary - self.header = header - self.level = level - self.event_level = event_level - self.reason = reason - self.article = article - self.links = links - self.impact_start_time = impact_start_time - self.impact_mitigation_time = impact_mitigation_time - self.impact = impact - self.recommended_actions = recommended_actions - self.faqs = faqs - self.is_hir = is_hir - self.enable_microsoft_support = enable_microsoft_support - self.description = description - self.platform_initiated = platform_initiated - self.enable_chat_with_us = enable_chat_with_us - self.priority = priority - self.last_update_time = last_update_time - self.hir_stage = hir_stage - - -class EventPropertiesArticle(_serialization.Model): - """Article of event. - - :ivar article_content: Article content of event. - :vartype article_content: str - :ivar article_id: Article Id. - :vartype article_id: str - :ivar parameters: It provides a map of parameter name and value. - :vartype parameters: JSON - """ - - _attribute_map = { - "article_content": {"key": "articleContent", "type": "str"}, - "article_id": {"key": "articleId", "type": "str"}, - "parameters": {"key": "parameters", "type": "object"}, - } - - def __init__( - self, - *, - article_content: Optional[str] = None, - article_id: Optional[str] = None, - parameters: Optional[JSON] = None, - **kwargs: Any - ) -> None: - """ - :keyword article_content: Article content of event. - :paramtype article_content: str - :keyword article_id: Article Id. - :paramtype article_id: str - :keyword parameters: It provides a map of parameter name and value. - :paramtype parameters: JSON - """ - super().__init__(**kwargs) - self.article_content = article_content - self.article_id = article_id - self.parameters = parameters - - -class EventPropertiesRecommendedActions(_serialization.Model): - """Recommended actions of event. - - :ivar message: Recommended action title for the service health event. - :vartype message: str - :ivar actions: Recommended actions for the service health event. - :vartype actions: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.EventPropertiesRecommendedActionsItem] - :ivar locale_code: Recommended action locale for the service health event. - :vartype locale_code: str - """ - - _attribute_map = { - "message": {"key": "message", "type": "str"}, - "actions": {"key": "actions", "type": "[EventPropertiesRecommendedActionsItem]"}, - "locale_code": {"key": "localeCode", "type": "str"}, - } - - def __init__( - self, - *, - message: Optional[str] = None, - actions: Optional[List["_models.EventPropertiesRecommendedActionsItem"]] = None, - locale_code: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword message: Recommended action title for the service health event. - :paramtype message: str - :keyword actions: Recommended actions for the service health event. - :paramtype actions: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.EventPropertiesRecommendedActionsItem] - :keyword locale_code: Recommended action locale for the service health event. - :paramtype locale_code: str - """ - super().__init__(**kwargs) - self.message = message - self.actions = actions - self.locale_code = locale_code - - -class EventPropertiesRecommendedActionsItem(_serialization.Model): - """Recommended action for the service health event. - - :ivar group_id: Recommended action group Id for the service health event. - :vartype group_id: int - :ivar action_text: Recommended action text. - :vartype action_text: str - """ - - _attribute_map = { - "group_id": {"key": "groupId", "type": "int"}, - "action_text": {"key": "actionText", "type": "str"}, - } - - def __init__(self, *, group_id: Optional[int] = None, action_text: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword group_id: Recommended action group Id for the service health event. - :paramtype group_id: int - :keyword action_text: Recommended action text. - :paramtype action_text: str - """ - super().__init__(**kwargs) - self.group_id = group_id - self.action_text = action_text - - -class Events(_serialization.Model): - """The List events operation response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The list of event. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Event] - :ivar next_link: The URI to fetch the next page of events. Call ListNext() with this URI to - fetch the next page of events. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Event]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Event"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of event. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Event] - :keyword next_link: The URI to fetch the next page of events. Call ListNext() with this URI to - fetch the next page of events. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Faq(_serialization.Model): - """Frequently asked question for the service health event. - - :ivar question: FAQ question for the service health event. - :vartype question: str - :ivar answer: FAQ answer for the service health event. - :vartype answer: str - :ivar locale_code: FAQ locale for the service health event. - :vartype locale_code: str - """ - - _attribute_map = { - "question": {"key": "question", "type": "str"}, - "answer": {"key": "answer", "type": "str"}, - "locale_code": {"key": "localeCode", "type": "str"}, - } - - def __init__( - self, - *, - question: Optional[str] = None, - answer: Optional[str] = None, - locale_code: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword question: FAQ question for the service health event. - :paramtype question: str - :keyword answer: FAQ answer for the service health event. - :paramtype answer: str - :keyword locale_code: FAQ locale for the service health event. - :paramtype locale_code: str - """ - super().__init__(**kwargs) - self.question = question - self.answer = answer - self.locale_code = locale_code - - -class Impact(_serialization.Model): - """Azure service impacted by the service health event. - - :ivar impacted_service: Impacted service name. - :vartype impacted_service: str - :ivar impacted_regions: List regions impacted by the service health event. - :vartype impacted_regions: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.ImpactedServiceRegion] - """ - - _attribute_map = { - "impacted_service": {"key": "impactedService", "type": "str"}, - "impacted_regions": {"key": "impactedRegions", "type": "[ImpactedServiceRegion]"}, - } - - def __init__( - self, - *, - impacted_service: Optional[str] = None, - impacted_regions: Optional[List["_models.ImpactedServiceRegion"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword impacted_service: Impacted service name. - :paramtype impacted_service: str - :keyword impacted_regions: List regions impacted by the service health event. - :paramtype impacted_regions: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.ImpactedServiceRegion] - """ - super().__init__(**kwargs) - self.impacted_service = impacted_service - self.impacted_regions = impacted_regions - - -class ImpactedRegion(_serialization.Model): - """Object of impacted region. - - :ivar id: The impacted region id. - :vartype id: str - :ivar name: The impacted region name. - :vartype name: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The impacted region id. - :paramtype id: str - :keyword name: The impacted region name. - :paramtype name: str - """ - super().__init__(**kwargs) - self.id = id - self.name = name - - -class ImpactedServiceRegion(_serialization.Model): - """Azure region impacted by the service health event. - - :ivar impacted_region: Impacted region name. - :vartype impacted_region: str - :ivar status: Current status of event in the region. Known values are: "Active" and "Resolved". - :vartype status: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventStatusValues - :ivar impacted_subscriptions: List subscription impacted by the service health event. - :vartype impacted_subscriptions: list[str] - :ivar last_update_time: It provides the Timestamp for when the last update for the service - health event. - :vartype last_update_time: ~datetime.datetime - :ivar updates: List of updates for given service health event. - :vartype updates: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Update] - """ - - _attribute_map = { - "impacted_region": {"key": "impactedRegion", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "impacted_subscriptions": {"key": "impactedSubscriptions", "type": "[str]"}, - "last_update_time": {"key": "lastUpdateTime", "type": "iso-8601"}, - "updates": {"key": "updates", "type": "[Update]"}, - } - - def __init__( - self, - *, - impacted_region: Optional[str] = None, - status: Optional[Union[str, "_models.EventStatusValues"]] = None, - impacted_subscriptions: Optional[List[str]] = None, - last_update_time: Optional[datetime.datetime] = None, - updates: Optional[List["_models.Update"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword impacted_region: Impacted region name. - :paramtype impacted_region: str - :keyword status: Current status of event in the region. Known values are: "Active" and - "Resolved". - :paramtype status: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventStatusValues - :keyword impacted_subscriptions: List subscription impacted by the service health event. - :paramtype impacted_subscriptions: list[str] - :keyword last_update_time: It provides the Timestamp for when the last update for the service - health event. - :paramtype last_update_time: ~datetime.datetime - :keyword updates: List of updates for given service health event. - :paramtype updates: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Update] - """ - super().__init__(**kwargs) - self.impacted_region = impacted_region - self.status = status - self.impacted_subscriptions = impacted_subscriptions - self.last_update_time = last_update_time - self.updates = updates - - -class Link(_serialization.Model): - """Useful links for service health event. - - :ivar type: Type of link. Known values are: "Button" and "Hyperlink". - :vartype type: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.LinkTypeValues - :ivar display_text: Display text of link. - :vartype display_text: ~azure.mgmt.resourcehealth.v2018_07_01.models.LinkDisplayText - :ivar extension_name: It provides the name of portal extension to produce link for given - service health event. - :vartype extension_name: str - :ivar blade_name: It provides the name of portal extension blade to produce link for given - service health event. - :vartype blade_name: str - :ivar parameters: It provides a map of parameter name and value for portal extension blade to - produce lik for given service health event. - :vartype parameters: JSON - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "display_text": {"key": "displayText", "type": "LinkDisplayText"}, - "extension_name": {"key": "extensionName", "type": "str"}, - "blade_name": {"key": "bladeName", "type": "str"}, - "parameters": {"key": "parameters", "type": "object"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.LinkTypeValues"]] = None, - display_text: Optional["_models.LinkDisplayText"] = None, - extension_name: Optional[str] = None, - blade_name: Optional[str] = None, - parameters: Optional[JSON] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of link. Known values are: "Button" and "Hyperlink". - :paramtype type: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.LinkTypeValues - :keyword display_text: Display text of link. - :paramtype display_text: ~azure.mgmt.resourcehealth.v2018_07_01.models.LinkDisplayText - :keyword extension_name: It provides the name of portal extension to produce link for given - service health event. - :paramtype extension_name: str - :keyword blade_name: It provides the name of portal extension blade to produce link for given - service health event. - :paramtype blade_name: str - :keyword parameters: It provides a map of parameter name and value for portal extension blade - to produce lik for given service health event. - :paramtype parameters: JSON - """ - super().__init__(**kwargs) - self.type = type - self.display_text = display_text - self.extension_name = extension_name - self.blade_name = blade_name - self.parameters = parameters - - -class LinkDisplayText(_serialization.Model): - """Display text of link. - - :ivar value: Display text of link. - :vartype value: str - :ivar localized_value: Localized display text of link. - :vartype localized_value: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Display text of link. - :paramtype value: str - :keyword localized_value: Localized display text of link. - :paramtype localized_value: str - """ - super().__init__(**kwargs) - self.value = value - self.localized_value = localized_value - - -class MetadataEntity(Resource): - """The metadata entity contract. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar display_name: The display name. - :vartype display_name: str - :ivar depends_on: The list of keys on which this entity depends on. - :vartype depends_on: list[str] - :ivar applicable_scenarios: The list of scenarios applicable to this metadata entity. - :vartype applicable_scenarios: list[str or - ~azure.mgmt.resourcehealth.v2018_07_01.models.Scenario] - :ivar supported_values: The list of supported values. - :vartype supported_values: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.MetadataSupportedValueDetail] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "depends_on": {"key": "properties.dependsOn", "type": "[str]"}, - "applicable_scenarios": {"key": "properties.applicableScenarios", "type": "[str]"}, - "supported_values": {"key": "properties.supportedValues", "type": "[MetadataSupportedValueDetail]"}, - } - - def __init__( - self, - *, - display_name: Optional[str] = None, - depends_on: Optional[List[str]] = None, - applicable_scenarios: Optional[List[Union[str, "_models.Scenario"]]] = None, - supported_values: Optional[List["_models.MetadataSupportedValueDetail"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword display_name: The display name. - :paramtype display_name: str - :keyword depends_on: The list of keys on which this entity depends on. - :paramtype depends_on: list[str] - :keyword applicable_scenarios: The list of scenarios applicable to this metadata entity. - :paramtype applicable_scenarios: list[str or - ~azure.mgmt.resourcehealth.v2018_07_01.models.Scenario] - :keyword supported_values: The list of supported values. - :paramtype supported_values: - list[~azure.mgmt.resourcehealth.v2018_07_01.models.MetadataSupportedValueDetail] - """ - super().__init__(**kwargs) - self.display_name = display_name - self.depends_on = depends_on - self.applicable_scenarios = applicable_scenarios - self.supported_values = supported_values - - -class MetadataEntityListResult(_serialization.Model): - """The list of metadata entities. - - :ivar value: The list of metadata entities. - :vartype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.MetadataEntity] - :ivar next_link: The link used to get the next page of metadata. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MetadataEntity]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.MetadataEntity"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of metadata entities. - :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.MetadataEntity] - :keyword next_link: The link used to get the next page of metadata. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MetadataSupportedValueDetail(_serialization.Model): - """The metadata supported value detail. - - :ivar id: The id. - :vartype id: str - :ivar display_name: The display name. - :vartype display_name: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - display_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id. - :paramtype id: str - :keyword display_name: The display name. - :paramtype display_name: str - """ - super().__init__(**kwargs) - self.id = id - self.display_name = display_name - - -class Operation(_serialization.Model): - """Operation available in the resourcehealth resource provider. - - :ivar name: Name of the operation. - :vartype name: str - :ivar display: Properties of the operation. - :vartype display: ~azure.mgmt.resourcehealth.v2018_07_01.models.OperationDisplay - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, - } - - def __init__( - self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any - ) -> None: - """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword display: Properties of the operation. - :paramtype display: ~azure.mgmt.resourcehealth.v2018_07_01.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(_serialization.Model): - """Properties of the operation. - - :ivar provider: Provider name. - :vartype provider: str - :ivar resource: Resource name. - :vartype resource: str - :ivar operation: Operation name. - :vartype operation: str - :ivar description: Description of the operation. - :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: Provider name. - :paramtype provider: str - :keyword resource: Resource name. - :paramtype resource: str - :keyword operation: Operation name. - :paramtype operation: str - :keyword description: Description of the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationListResult(_serialization.Model): - """Lists the operations response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: List of operations available in the resourcehealth resource provider. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Operation] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - } - - def __init__(self, *, value: List["_models.Operation"], **kwargs: Any) -> None: - """ - :keyword value: List of operations available in the resourcehealth resource provider. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Operation] - """ - super().__init__(**kwargs) - self.value = value - - -class RecommendedAction(_serialization.Model): - """Lists actions the user can take based on the current availabilityState of the resource. - - :ivar action: Recommended action. - :vartype action: str - :ivar action_url: Link to the action. - :vartype action_url: str - :ivar action_url_comment: the comment for the Action. - :vartype action_url_comment: str - :ivar action_url_text: Substring of action, it describes which text should host the action url. - :vartype action_url_text: str - """ - - _attribute_map = { - "action": {"key": "action", "type": "str"}, - "action_url": {"key": "actionUrl", "type": "str"}, - "action_url_comment": {"key": "_ActionUrl\\.Comment", "type": "str"}, - "action_url_text": {"key": "actionUrlText", "type": "str"}, - } - - def __init__( - self, - *, - action: Optional[str] = None, - action_url: Optional[str] = None, - action_url_comment: Optional[str] = None, - action_url_text: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword action: Recommended action. - :paramtype action: str - :keyword action_url: Link to the action. - :paramtype action_url: str - :keyword action_url_comment: the comment for the Action. - :paramtype action_url_comment: str - :keyword action_url_text: Substring of action, it describes which text should host the action - url. - :paramtype action_url_text: str - """ - super().__init__(**kwargs) - self.action = action - self.action_url = action_url - self.action_url_comment = action_url_comment - self.action_url_text = action_url_text - - -class ServiceImpactingEvent(_serialization.Model): - """Lists the service impacting events that may be affecting the health of the resource. - - :ivar event_start_time: Timestamp for when the event started. - :vartype event_start_time: ~datetime.datetime - :ivar event_status_last_modified_time: Timestamp for when event was submitted/detected. - :vartype event_status_last_modified_time: ~datetime.datetime - :ivar correlation_id: Correlation id for the event. - :vartype correlation_id: str - :ivar status: Status of the service impacting event. - :vartype status: ~azure.mgmt.resourcehealth.v2018_07_01.models.ServiceImpactingEventStatus - :ivar incident_properties: Properties of the service impacting event. - :vartype incident_properties: - ~azure.mgmt.resourcehealth.v2018_07_01.models.ServiceImpactingEventIncidentProperties - """ - - _attribute_map = { - "event_start_time": {"key": "eventStartTime", "type": "iso-8601"}, - "event_status_last_modified_time": {"key": "eventStatusLastModifiedTime", "type": "iso-8601"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - "status": {"key": "status", "type": "ServiceImpactingEventStatus"}, - "incident_properties": {"key": "incidentProperties", "type": "ServiceImpactingEventIncidentProperties"}, - } - - def __init__( - self, - *, - event_start_time: Optional[datetime.datetime] = None, - event_status_last_modified_time: Optional[datetime.datetime] = None, - correlation_id: Optional[str] = None, - status: Optional["_models.ServiceImpactingEventStatus"] = None, - incident_properties: Optional["_models.ServiceImpactingEventIncidentProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword event_start_time: Timestamp for when the event started. - :paramtype event_start_time: ~datetime.datetime - :keyword event_status_last_modified_time: Timestamp for when event was submitted/detected. - :paramtype event_status_last_modified_time: ~datetime.datetime - :keyword correlation_id: Correlation id for the event. - :paramtype correlation_id: str - :keyword status: Status of the service impacting event. - :paramtype status: ~azure.mgmt.resourcehealth.v2018_07_01.models.ServiceImpactingEventStatus - :keyword incident_properties: Properties of the service impacting event. - :paramtype incident_properties: - ~azure.mgmt.resourcehealth.v2018_07_01.models.ServiceImpactingEventIncidentProperties - """ - super().__init__(**kwargs) - self.event_start_time = event_start_time - self.event_status_last_modified_time = event_status_last_modified_time - self.correlation_id = correlation_id - self.status = status - self.incident_properties = incident_properties - - -class ServiceImpactingEventIncidentProperties(_serialization.Model): - """Properties of the service impacting event. - - :ivar title: Title of the incident. - :vartype title: str - :ivar service: Service impacted by the event. - :vartype service: str - :ivar region: Region impacted by the event. - :vartype region: str - :ivar incident_type: Type of Event. - :vartype incident_type: str - """ - - _attribute_map = { - "title": {"key": "title", "type": "str"}, - "service": {"key": "service", "type": "str"}, - "region": {"key": "region", "type": "str"}, - "incident_type": {"key": "incidentType", "type": "str"}, - } - - def __init__( - self, - *, - title: Optional[str] = None, - service: Optional[str] = None, - region: Optional[str] = None, - incident_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword title: Title of the incident. - :paramtype title: str - :keyword service: Service impacted by the event. - :paramtype service: str - :keyword region: Region impacted by the event. - :paramtype region: str - :keyword incident_type: Type of Event. - :paramtype incident_type: str - """ - super().__init__(**kwargs) - self.title = title - self.service = service - self.region = region - self.incident_type = incident_type - - -class ServiceImpactingEventStatus(_serialization.Model): - """Status of the service impacting event. - - :ivar value: Current status of the event. - :vartype value: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Current status of the event. - :paramtype value: str - """ - super().__init__(**kwargs) - self.value = value - - -class StatusActiveEvent(_serialization.Model): - """Active event type of emerging issue. - - :ivar title: The active event title. - :vartype title: str - :ivar description: The details of active event. - :vartype description: str - :ivar tracking_id: The tracking id of this active event. - :vartype tracking_id: str - :ivar start_time: The impact start time on this active event. - :vartype start_time: ~datetime.datetime - :ivar cloud: The cloud type of this active event. - :vartype cloud: str - :ivar severity: The severity level of this active event. Known values are: "Information", - "Warning", and "Error". - :vartype severity: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.SeverityValues - :ivar stage: The stage of this active event. Known values are: "Active", "Resolve", and - "Archived". - :vartype stage: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.StageValues - :ivar published: The boolean value of this active event if published or not. - :vartype published: bool - :ivar last_modified_time: The last time modified on this banner. - :vartype last_modified_time: ~datetime.datetime - :ivar impacts: The list of emerging issues impacts. - :vartype impacts: list[~azure.mgmt.resourcehealth.v2018_07_01.models.EmergingIssueImpact] - """ - - _attribute_map = { - "title": {"key": "title", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "tracking_id": {"key": "trackingId", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "cloud": {"key": "cloud", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "stage": {"key": "stage", "type": "str"}, - "published": {"key": "published", "type": "bool"}, - "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, - "impacts": {"key": "impacts", "type": "[EmergingIssueImpact]"}, - } - - def __init__( - self, - *, - title: Optional[str] = None, - description: Optional[str] = None, - tracking_id: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - cloud: Optional[str] = None, - severity: Optional[Union[str, "_models.SeverityValues"]] = None, - stage: Optional[Union[str, "_models.StageValues"]] = None, - published: Optional[bool] = None, - last_modified_time: Optional[datetime.datetime] = None, - impacts: Optional[List["_models.EmergingIssueImpact"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword title: The active event title. - :paramtype title: str - :keyword description: The details of active event. - :paramtype description: str - :keyword tracking_id: The tracking id of this active event. - :paramtype tracking_id: str - :keyword start_time: The impact start time on this active event. - :paramtype start_time: ~datetime.datetime - :keyword cloud: The cloud type of this active event. - :paramtype cloud: str - :keyword severity: The severity level of this active event. Known values are: "Information", - "Warning", and "Error". - :paramtype severity: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.SeverityValues - :keyword stage: The stage of this active event. Known values are: "Active", "Resolve", and - "Archived". - :paramtype stage: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.StageValues - :keyword published: The boolean value of this active event if published or not. - :paramtype published: bool - :keyword last_modified_time: The last time modified on this banner. - :paramtype last_modified_time: ~datetime.datetime - :keyword impacts: The list of emerging issues impacts. - :paramtype impacts: list[~azure.mgmt.resourcehealth.v2018_07_01.models.EmergingIssueImpact] - """ - super().__init__(**kwargs) - self.title = title - self.description = description - self.tracking_id = tracking_id - self.start_time = start_time - self.cloud = cloud - self.severity = severity - self.stage = stage - self.published = published - self.last_modified_time = last_modified_time - self.impacts = impacts - - -class StatusBanner(_serialization.Model): - """Banner type of emerging issue. - - :ivar title: The banner title. - :vartype title: str - :ivar message: The details of banner. - :vartype message: str - :ivar cloud: The cloud type of this banner. - :vartype cloud: str - :ivar last_modified_time: The last time modified on this banner. - :vartype last_modified_time: ~datetime.datetime - """ - - _attribute_map = { - "title": {"key": "title", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "cloud": {"key": "cloud", "type": "str"}, - "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - title: Optional[str] = None, - message: Optional[str] = None, - cloud: Optional[str] = None, - last_modified_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword title: The banner title. - :paramtype title: str - :keyword message: The details of banner. - :paramtype message: str - :keyword cloud: The cloud type of this banner. - :paramtype cloud: str - :keyword last_modified_time: The last time modified on this banner. - :paramtype last_modified_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.title = title - self.message = message - self.cloud = cloud - self.last_modified_time = last_modified_time - - -class Update(_serialization.Model): - """Update for service health event. - - :ivar summary: Summary text for the given update for the service health event. - :vartype summary: str - :ivar update_date_time: It provides the Timestamp for the given update for the service health - event. - :vartype update_date_time: ~datetime.datetime - """ - - _attribute_map = { - "summary": {"key": "summary", "type": "str"}, - "update_date_time": {"key": "updateDateTime", "type": "iso-8601"}, - } - - def __init__( - self, *, summary: Optional[str] = None, update_date_time: Optional[datetime.datetime] = None, **kwargs: Any - ) -> None: - """ - :keyword summary: Summary text for the given update for the service health event. - :paramtype summary: str - :keyword update_date_time: It provides the Timestamp for the given update for the service - health event. - :paramtype update_date_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.summary = summary - self.update_date_time = update_date_time diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_resource_health_mgmt_client_enums.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_resource_health_mgmt_client_enums.py deleted file mode 100644 index f887608f9d45..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_resource_health_mgmt_client_enums.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class AvailabilityStateValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Availability status of the resource. When it is null, this availabilityStatus object represents - an availability impacting event. - """ - - AVAILABLE = "Available" - UNAVAILABLE = "Unavailable" - DEGRADED = "Degraded" - UNKNOWN = "Unknown" - - -class Enum8(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum8.""" - - DEFAULT = "default" - - -class EventLevelValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Level of event.""" - - CRITICAL = "Critical" - ERROR = "Error" - WARNING = "Warning" - INFORMATIONAL = "Informational" - - -class EventSourceValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Source of event.""" - - RESOURCE_HEALTH = "ResourceHealth" - SERVICE_HEALTH = "ServiceHealth" - - -class EventStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Current status of event.""" - - ACTIVE = "Active" - RESOLVED = "Resolved" - - -class EventTypeValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of event.""" - - SERVICE_ISSUE = "ServiceIssue" - PLANNED_MAINTENANCE = "PlannedMaintenance" - HEALTH_ADVISORY = "HealthAdvisory" - RCA = "RCA" - EMERGING_ISSUES = "EmergingIssues" - SECURITY_ADVISORY = "SecurityAdvisory" - - -class LevelValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Level of insight.""" - - CRITICAL = "Critical" - WARNING = "Warning" - - -class LinkTypeValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of link.""" - - BUTTON = "Button" - HYPERLINK = "Hyperlink" - - -class ReasonChronicityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Chronicity of the availability transition.""" - - TRANSIENT = "Transient" - PERSISTENT = "Persistent" - - -class Scenario(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scenario.""" - - ALERTS = "Alerts" - - -class SeverityValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The severity level of this active event.""" - - INFORMATION = "Information" - WARNING = "Warning" - ERROR = "Error" - - -class StageValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The stage of this active event.""" - - ACTIVE = "Active" - RESOLVE = "Resolve" - ARCHIVED = "Archived" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py deleted file mode 100644 index 4d84024fc0a6..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py +++ /dev/null @@ -1,27 +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 ._events_operations import EventsOperations -from ._availability_statuses_operations import AvailabilityStatusesOperations -from ._operations import Operations -from ._emerging_issues_operations import EmergingIssuesOperations -from ._metadata_operations import MetadataOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EventsOperations", - "AvailabilityStatusesOperations", - "Operations", - "EmergingIssuesOperations", - "MetadataOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py deleted file mode 100644 index 9a43dace345e..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py +++ /dev/null @@ -1,561 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_id_request( - subscription_id: str, *, filter: Optional[str] = None, expand: 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", "2018-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "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, - *, - filter: Optional[str] = None, - expand: 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", "2018-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_by_resource_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2018-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2018-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s - :attr:`availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the subscription. - - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the resource group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace - def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists all historical availability transitions and impacting events for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py deleted file mode 100644 index d65dda980754..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py +++ /dev/null @@ -1,238 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(issue_name: Union[str, _models.Enum8], **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}") - path_format_arguments = { - "issueName": _SERIALIZER.url("issue_name", issue_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_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/emergingIssues") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class EmergingIssuesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s - :attr:`emerging_issues` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.EmergingIssuesGetResult: - """Gets Azure services' emerging issues. - - :param issue_name: The name of the emerging issue. "default" Required. - :type issue_name: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.Enum8 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmergingIssuesGetResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2018_07_01.models.EmergingIssuesGetResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) - cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) - - request = build_get_request( - issue_name=issue_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: - """Lists Azure services' emerging issues. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EmergingIssuesGetResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.EmergingIssuesGetResult] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("EmergingIssueListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py deleted file mode 100644 index ca3c11733d30..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py +++ /dev/null @@ -1,328 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_id_request( - subscription_id: str, - *, - filter: Optional[str] = None, - query_start_time: Optional[str] = None, - view: 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", "2018-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events") - 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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if query_start_time is not None: - _params["queryStartTime"] = _SERIALIZER.query("query_start_time", query_start_time, "str") - if view is not None: - _params["view"] = _SERIALIZER.query("view", view, "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_single_resource_request( - resource_uri: str, *, filter: Optional[str] = None, view: 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", "2018-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/events") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if view is not None: - _params["view"] = _SERIALIZER.query("view", view, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class EventsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s - :attr:`events` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, - filter: Optional[str] = None, - query_start_time: Optional[str] = None, - view: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.Event"]: - """Lists current service health events in the subscription. - - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :param view: setting view=full expands the article parameters. Default value is None. - :type view: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.Event] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - query_start_time=query_start_time, - view=view, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" - } - - @distributed_trace - def list_by_single_resource( - self, resource_uri: str, filter: Optional[str] = None, view: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Event"]: - """Lists current service health events for given resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: A valid odata query to limit the events returned. The logical operators and, or, - equal, not equal, and top are supported. For example, $filter=Properties/EventType eq - 'ServiceIssue' or Properties/EventType eq 'PlannedMaintenance' OR - %24filter=Properties%2FEventType%20eq%20%27ServiceIssue%27%20or%20Properties%2FEventType%20eq%20%27PlannedMaintenance%27. - Default value is None. - :type filter: str - :param view: setting view=full expands the article parameters. Default value is None. - :type view: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2018_07_01.models.Event] - :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._api_version or "2018-07-01")) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_single_resource_request( - resource_uri=resource_uri, - filter=filter, - view=view, - api_version=api_version, - template_url=self.list_by_single_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py deleted file mode 100644 index d0671807cc1b..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py +++ /dev/null @@ -1,127 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> _models.OperationListResult: - """Lists available operations for the resourcehealth resource provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2018_07_01.models.OperationListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _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("OperationListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/py.typed b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/__init__.py deleted file mode 100644 index f1e7a4fdd09e..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/__init__.py +++ /dev/null @@ -1,26 +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 ._resource_health_mgmt_client import ResourceHealthMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ResourceHealthMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_configuration.py deleted file mode 100644 index db8ec5454a31..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_configuration.py +++ /dev/null @@ -1,66 +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 typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ResourceHealthMgmtClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-10-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_metadata.json deleted file mode 100644 index ed81da05bb5b..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_metadata.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "chosen_version": "2022-10-01", - "total_api_version_list": ["2022-10-01"], - "client": { - "name": "ResourceHealthMgmtClient", - "filename": "_resource_health_mgmt_client", - "description": "The Resource Health Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "availability_statuses": "AvailabilityStatusesOperations", - "operations": "Operations", - "metadata": "MetadataOperations", - "impacted_resources": "ImpactedResourcesOperations", - "security_advisory_impacted_resources": "SecurityAdvisoryImpactedResourcesOperations", - "events": "EventsOperations", - "event": "EventOperations", - "child_availability_statuses": "ChildAvailabilityStatusesOperations", - "child_resources": "ChildResourcesOperations", - "emerging_issues": "EmergingIssuesOperations" - } -} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_resource_health_mgmt_client.py deleted file mode 100644 index 25d2d5c6fa9c..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_resource_health_mgmt_client.py +++ /dev/null @@ -1,146 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ResourceHealthMgmtClientConfiguration -from .operations import ( - AvailabilityStatusesOperations, - ChildAvailabilityStatusesOperations, - ChildResourcesOperations, - EmergingIssuesOperations, - EventOperations, - EventsOperations, - ImpactedResourcesOperations, - MetadataOperations, - Operations, - SecurityAdvisoryImpactedResourcesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """The Resource Health Client. - - :ivar availability_statuses: AvailabilityStatusesOperations operations - :vartype availability_statuses: - azure.mgmt.resourcehealth.v2022_10_01.operations.AvailabilityStatusesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resourcehealth.v2022_10_01.operations.Operations - :ivar metadata: MetadataOperations operations - :vartype metadata: azure.mgmt.resourcehealth.v2022_10_01.operations.MetadataOperations - :ivar impacted_resources: ImpactedResourcesOperations operations - :vartype impacted_resources: - azure.mgmt.resourcehealth.v2022_10_01.operations.ImpactedResourcesOperations - :ivar security_advisory_impacted_resources: SecurityAdvisoryImpactedResourcesOperations - operations - :vartype security_advisory_impacted_resources: - azure.mgmt.resourcehealth.v2022_10_01.operations.SecurityAdvisoryImpactedResourcesOperations - :ivar events: EventsOperations operations - :vartype events: azure.mgmt.resourcehealth.v2022_10_01.operations.EventsOperations - :ivar event: EventOperations operations - :vartype event: azure.mgmt.resourcehealth.v2022_10_01.operations.EventOperations - :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations - :vartype child_availability_statuses: - azure.mgmt.resourcehealth.v2022_10_01.operations.ChildAvailabilityStatusesOperations - :ivar child_resources: ChildResourcesOperations operations - :vartype child_resources: - azure.mgmt.resourcehealth.v2022_10_01.operations.ChildResourcesOperations - :ivar emerging_issues: EmergingIssuesOperations operations - :vartype emerging_issues: - azure.mgmt.resourcehealth.v2022_10_01.operations.EmergingIssuesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ResourceHealthMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.availability_statuses = AvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") - self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") - self.impacted_resources = ImpactedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.security_advisory_impacted_resources = SecurityAdvisoryImpactedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") - self.event = EventOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") - self.child_availability_statuses = ChildAvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.child_resources = ChildResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.emerging_issues = EmergingIssuesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "ResourceHealthMgmtClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_vendor.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_version.py deleted file mode 100644 index 9cf33092d41b..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b5" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/__init__.py deleted file mode 100644 index d95ad182aa0f..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/__init__.py +++ /dev/null @@ -1,23 +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 ._resource_health_mgmt_client import ResourceHealthMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ResourceHealthMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_configuration.py deleted file mode 100644 index b820b5733897..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_configuration.py +++ /dev/null @@ -1,66 +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 typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ResourceHealthMgmtClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-10-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_resource_health_mgmt_client.py deleted file mode 100644 index 51897642a163..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_resource_health_mgmt_client.py +++ /dev/null @@ -1,146 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ResourceHealthMgmtClientConfiguration -from .operations import ( - AvailabilityStatusesOperations, - ChildAvailabilityStatusesOperations, - ChildResourcesOperations, - EmergingIssuesOperations, - EventOperations, - EventsOperations, - ImpactedResourcesOperations, - MetadataOperations, - Operations, - SecurityAdvisoryImpactedResourcesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """The Resource Health Client. - - :ivar availability_statuses: AvailabilityStatusesOperations operations - :vartype availability_statuses: - azure.mgmt.resourcehealth.v2022_10_01.aio.operations.AvailabilityStatusesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resourcehealth.v2022_10_01.aio.operations.Operations - :ivar metadata: MetadataOperations operations - :vartype metadata: azure.mgmt.resourcehealth.v2022_10_01.aio.operations.MetadataOperations - :ivar impacted_resources: ImpactedResourcesOperations operations - :vartype impacted_resources: - azure.mgmt.resourcehealth.v2022_10_01.aio.operations.ImpactedResourcesOperations - :ivar security_advisory_impacted_resources: SecurityAdvisoryImpactedResourcesOperations - operations - :vartype security_advisory_impacted_resources: - azure.mgmt.resourcehealth.v2022_10_01.aio.operations.SecurityAdvisoryImpactedResourcesOperations - :ivar events: EventsOperations operations - :vartype events: azure.mgmt.resourcehealth.v2022_10_01.aio.operations.EventsOperations - :ivar event: EventOperations operations - :vartype event: azure.mgmt.resourcehealth.v2022_10_01.aio.operations.EventOperations - :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations - :vartype child_availability_statuses: - azure.mgmt.resourcehealth.v2022_10_01.aio.operations.ChildAvailabilityStatusesOperations - :ivar child_resources: ChildResourcesOperations operations - :vartype child_resources: - azure.mgmt.resourcehealth.v2022_10_01.aio.operations.ChildResourcesOperations - :ivar emerging_issues: EmergingIssuesOperations operations - :vartype emerging_issues: - azure.mgmt.resourcehealth.v2022_10_01.aio.operations.EmergingIssuesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ResourceHealthMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.availability_statuses = AvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") - self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") - self.impacted_resources = ImpactedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.security_advisory_impacted_resources = SecurityAdvisoryImpactedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") - self.event = EventOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") - self.child_availability_statuses = ChildAvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.child_resources = ChildResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - self.emerging_issues = EmergingIssuesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-10-01" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "ResourceHealthMgmtClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_metadata_operations.py deleted file mode 100644 index 86c8850c6eb5..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_metadata_operations.py +++ /dev/null @@ -1,192 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._metadata_operations import build_get_entity_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s - :attr:`metadata` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.MetadataEntity"]: - """Gets the list of metadata entities. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MetadataEntity or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity] - :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._api_version or "2022-10-01")) - cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MetadataEntityListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} - - @distributed_trace_async - async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: - """Gets the list of metadata entities. - - :param name: Name of metadata entity. Required. - :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MetadataEntity or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) - cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) - - request = build_get_entity_request( - name=name, - api_version=api_version, - template_url=self.get_entity.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetadataEntity", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_operations.py deleted file mode 100644 index 589dbe0aa522..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list(self, **kwargs: Any) -> _models.OperationListResult: - """Lists available operations for the resourcehealth resource provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.OperationListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _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("OperationListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/__init__.py deleted file mode 100644 index c1d58bb250a4..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/__init__.py +++ /dev/null @@ -1,125 +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 ._models_py3 import AvailabilityStatus -from ._models_py3 import AvailabilityStatusListResult -from ._models_py3 import AvailabilityStatusProperties -from ._models_py3 import AvailabilityStatusPropertiesRecentlyResolved -from ._models_py3 import EmergingIssueImpact -from ._models_py3 import EmergingIssueListResult -from ._models_py3 import EmergingIssuesGetResult -from ._models_py3 import ErrorResponse -from ._models_py3 import Event -from ._models_py3 import EventImpactedResource -from ._models_py3 import EventImpactedResourceListResult -from ._models_py3 import EventPropertiesAdditionalInformation -from ._models_py3 import EventPropertiesArticle -from ._models_py3 import EventPropertiesRecommendedActions -from ._models_py3 import EventPropertiesRecommendedActionsItem -from ._models_py3 import Events -from ._models_py3 import Faq -from ._models_py3 import Impact -from ._models_py3 import ImpactedRegion -from ._models_py3 import ImpactedResourceStatus -from ._models_py3 import ImpactedServiceRegion -from ._models_py3 import KeyValueItem -from ._models_py3 import Link -from ._models_py3 import LinkDisplayText -from ._models_py3 import MetadataEntity -from ._models_py3 import MetadataEntityListResult -from ._models_py3 import MetadataSupportedValueDetail -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import RecommendedAction -from ._models_py3 import Resource -from ._models_py3 import ServiceImpactingEvent -from ._models_py3 import ServiceImpactingEventIncidentProperties -from ._models_py3 import ServiceImpactingEventStatus -from ._models_py3 import StatusActiveEvent -from ._models_py3 import StatusBanner -from ._models_py3 import SystemData -from ._models_py3 import Update - -from ._resource_health_mgmt_client_enums import AvailabilityStateValues -from ._resource_health_mgmt_client_enums import CreatedByType -from ._resource_health_mgmt_client_enums import EventLevelValues -from ._resource_health_mgmt_client_enums import EventSourceValues -from ._resource_health_mgmt_client_enums import EventStatusValues -from ._resource_health_mgmt_client_enums import EventTypeValues -from ._resource_health_mgmt_client_enums import IssueNameParameter -from ._resource_health_mgmt_client_enums import LevelValues -from ._resource_health_mgmt_client_enums import LinkTypeValues -from ._resource_health_mgmt_client_enums import ReasonChronicityTypes -from ._resource_health_mgmt_client_enums import ReasonTypeValues -from ._resource_health_mgmt_client_enums import Scenario -from ._resource_health_mgmt_client_enums import SeverityValues -from ._resource_health_mgmt_client_enums import StageValues -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AvailabilityStatus", - "AvailabilityStatusListResult", - "AvailabilityStatusProperties", - "AvailabilityStatusPropertiesRecentlyResolved", - "EmergingIssueImpact", - "EmergingIssueListResult", - "EmergingIssuesGetResult", - "ErrorResponse", - "Event", - "EventImpactedResource", - "EventImpactedResourceListResult", - "EventPropertiesAdditionalInformation", - "EventPropertiesArticle", - "EventPropertiesRecommendedActions", - "EventPropertiesRecommendedActionsItem", - "Events", - "Faq", - "Impact", - "ImpactedRegion", - "ImpactedResourceStatus", - "ImpactedServiceRegion", - "KeyValueItem", - "Link", - "LinkDisplayText", - "MetadataEntity", - "MetadataEntityListResult", - "MetadataSupportedValueDetail", - "Operation", - "OperationDisplay", - "OperationListResult", - "ProxyResource", - "RecommendedAction", - "Resource", - "ServiceImpactingEvent", - "ServiceImpactingEventIncidentProperties", - "ServiceImpactingEventStatus", - "StatusActiveEvent", - "StatusBanner", - "SystemData", - "Update", - "AvailabilityStateValues", - "CreatedByType", - "EventLevelValues", - "EventSourceValues", - "EventStatusValues", - "EventTypeValues", - "IssueNameParameter", - "LevelValues", - "LinkTypeValues", - "ReasonChronicityTypes", - "ReasonTypeValues", - "Scenario", - "SeverityValues", - "StageValues", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_models_py3.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_models_py3.py deleted file mode 100644 index d508bfdb1967..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_models_py3.py +++ /dev/null @@ -1,2140 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -import sys -from typing import Any, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AvailabilityStatus(_serialization.Model): - """availabilityStatus of a resource. - - :ivar id: Azure Resource Manager Identity for the availabilityStatuses resource. - :vartype id: str - :ivar name: current. - :vartype name: str - :ivar type: Microsoft.ResourceHealth/AvailabilityStatuses. - :vartype type: str - :ivar location: Azure Resource Manager geo location of the resource. - :vartype location: str - :ivar properties: Properties of availability state. - :vartype properties: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatusProperties - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "AvailabilityStatusProperties"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - location: Optional[str] = None, - properties: Optional["_models.AvailabilityStatusProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Azure Resource Manager Identity for the availabilityStatuses resource. - :paramtype id: str - :keyword name: current. - :paramtype name: str - :keyword type: Microsoft.ResourceHealth/AvailabilityStatuses. - :paramtype type: str - :keyword location: Azure Resource Manager geo location of the resource. - :paramtype location: str - :keyword properties: Properties of availability state. - :paramtype properties: - ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatusProperties - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.location = location - self.properties = properties - - -class AvailabilityStatusListResult(_serialization.Model): - """The List availabilityStatus operation response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The list of availabilityStatuses. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] - :ivar next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() with - this URI to fetch the next page of availabilityStatuses. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[AvailabilityStatus]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.AvailabilityStatus"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of availabilityStatuses. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] - :keyword next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() - with this URI to fetch the next page of availabilityStatuses. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Properties of availability state. - - :ivar availability_state: Availability status of the resource. When it is null, this - availabilityStatus object represents an availability impacting event. Known values are: - "Available", "Unavailable", "Degraded", and "Unknown". - :vartype availability_state: str or - ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStateValues - :ivar title: Title description of the availability status. - :vartype title: str - :ivar summary: Summary description of the availability status. - :vartype summary: str - :ivar detailed_status: Details of the availability status. - :vartype detailed_status: str - :ivar reason_type: When the resource's availabilityState is Unavailable, it describes where the - health impacting event was originated. Examples are planned, unplanned, user initiated or an - outage etc. - :vartype reason_type: str - :ivar context: When an event is created, it can either be triggered by a customer or the - platform of the resource and this field will illustrate that. This field is connected to the - category field in this object. - :vartype context: str - :ivar category: When a context field is set to Platform, this field will reflect if the event - was planned or unplanned. If the context field does not have a value of Platform, then this - field will be ignored. - :vartype category: str - :ivar article_id: The Article Id. - :vartype article_id: str - :ivar root_cause_attribution_time: When the resource's availabilityState is Unavailable, it - provides the Timestamp for when the health impacting event was received. - :vartype root_cause_attribution_time: ~datetime.datetime - :ivar health_event_type: In case of an availability impacting event, it describes when the - health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. - :vartype health_event_type: str - :ivar health_event_cause: In case of an availability impacting event, it describes where the - health impacting event was originated. Examples are PlatformInitiated, UserInitiated etc. - :vartype health_event_cause: str - :ivar health_event_category: In case of an availability impacting event, it describes the - category of a PlatformInitiated health impacting event. Examples are Planned, Unplanned etc. - :vartype health_event_category: str - :ivar health_event_id: It is a unique Id that identifies the event. - :vartype health_event_id: str - :ivar resolution_eta: When the resource's availabilityState is Unavailable and the reasonType - is not User Initiated, it provides the date and time for when the issue is expected to be - resolved. - :vartype resolution_eta: ~datetime.datetime - :ivar occured_time: Timestamp for when last change in health status occurred. - :vartype occured_time: ~datetime.datetime - :ivar reason_chronicity: Chronicity of the availability transition. Known values are: - "Transient" and "Persistent". - :vartype reason_chronicity: str or - ~azure.mgmt.resourcehealth.v2022_10_01.models.ReasonChronicityTypes - :ivar reported_time: Timestamp for when the health was last checked. - :vartype reported_time: ~datetime.datetime - :ivar recently_resolved: An annotation describing a change in the availabilityState to - Available from Unavailable with a reasonType of type Unplanned. - :vartype recently_resolved: - ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatusPropertiesRecentlyResolved - :ivar recommended_actions: Lists actions the user can take based on the current - availabilityState of the resource. - :vartype recommended_actions: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.RecommendedAction] - :ivar service_impacting_events: Lists the service impacting events that may be affecting the - health of the resource. - :vartype service_impacting_events: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEvent] - """ - - _attribute_map = { - "availability_state": {"key": "availabilityState", "type": "str"}, - "title": {"key": "title", "type": "str"}, - "summary": {"key": "summary", "type": "str"}, - "detailed_status": {"key": "detailedStatus", "type": "str"}, - "reason_type": {"key": "reasonType", "type": "str"}, - "context": {"key": "context", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "article_id": {"key": "articleId", "type": "str"}, - "root_cause_attribution_time": {"key": "rootCauseAttributionTime", "type": "iso-8601"}, - "health_event_type": {"key": "healthEventType", "type": "str"}, - "health_event_cause": {"key": "healthEventCause", "type": "str"}, - "health_event_category": {"key": "healthEventCategory", "type": "str"}, - "health_event_id": {"key": "healthEventId", "type": "str"}, - "resolution_eta": {"key": "resolutionETA", "type": "iso-8601"}, - "occured_time": {"key": "occuredTime", "type": "iso-8601"}, - "reason_chronicity": {"key": "reasonChronicity", "type": "str"}, - "reported_time": {"key": "reportedTime", "type": "iso-8601"}, - "recently_resolved": {"key": "recentlyResolved", "type": "AvailabilityStatusPropertiesRecentlyResolved"}, - "recommended_actions": {"key": "recommendedActions", "type": "[RecommendedAction]"}, - "service_impacting_events": {"key": "serviceImpactingEvents", "type": "[ServiceImpactingEvent]"}, - } - - def __init__( - self, - *, - availability_state: Optional[Union[str, "_models.AvailabilityStateValues"]] = None, - title: Optional[str] = None, - summary: Optional[str] = None, - detailed_status: Optional[str] = None, - reason_type: Optional[str] = None, - context: Optional[str] = None, - category: Optional[str] = None, - article_id: Optional[str] = None, - root_cause_attribution_time: Optional[datetime.datetime] = None, - health_event_type: Optional[str] = None, - health_event_cause: Optional[str] = None, - health_event_category: Optional[str] = None, - health_event_id: Optional[str] = None, - resolution_eta: Optional[datetime.datetime] = None, - occured_time: Optional[datetime.datetime] = None, - reason_chronicity: Optional[Union[str, "_models.ReasonChronicityTypes"]] = None, - reported_time: Optional[datetime.datetime] = None, - recently_resolved: Optional["_models.AvailabilityStatusPropertiesRecentlyResolved"] = None, - recommended_actions: Optional[List["_models.RecommendedAction"]] = None, - service_impacting_events: Optional[List["_models.ServiceImpactingEvent"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword availability_state: Availability status of the resource. When it is null, this - availabilityStatus object represents an availability impacting event. Known values are: - "Available", "Unavailable", "Degraded", and "Unknown". - :paramtype availability_state: str or - ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStateValues - :keyword title: Title description of the availability status. - :paramtype title: str - :keyword summary: Summary description of the availability status. - :paramtype summary: str - :keyword detailed_status: Details of the availability status. - :paramtype detailed_status: str - :keyword reason_type: When the resource's availabilityState is Unavailable, it describes where - the health impacting event was originated. Examples are planned, unplanned, user initiated or - an outage etc. - :paramtype reason_type: str - :keyword context: When an event is created, it can either be triggered by a customer or the - platform of the resource and this field will illustrate that. This field is connected to the - category field in this object. - :paramtype context: str - :keyword category: When a context field is set to Platform, this field will reflect if the - event was planned or unplanned. If the context field does not have a value of Platform, then - this field will be ignored. - :paramtype category: str - :keyword article_id: The Article Id. - :paramtype article_id: str - :keyword root_cause_attribution_time: When the resource's availabilityState is Unavailable, it - provides the Timestamp for when the health impacting event was received. - :paramtype root_cause_attribution_time: ~datetime.datetime - :keyword health_event_type: In case of an availability impacting event, it describes when the - health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. - :paramtype health_event_type: str - :keyword health_event_cause: In case of an availability impacting event, it describes where the - health impacting event was originated. Examples are PlatformInitiated, UserInitiated etc. - :paramtype health_event_cause: str - :keyword health_event_category: In case of an availability impacting event, it describes the - category of a PlatformInitiated health impacting event. Examples are Planned, Unplanned etc. - :paramtype health_event_category: str - :keyword health_event_id: It is a unique Id that identifies the event. - :paramtype health_event_id: str - :keyword resolution_eta: When the resource's availabilityState is Unavailable and the - reasonType is not User Initiated, it provides the date and time for when the issue is expected - to be resolved. - :paramtype resolution_eta: ~datetime.datetime - :keyword occured_time: Timestamp for when last change in health status occurred. - :paramtype occured_time: ~datetime.datetime - :keyword reason_chronicity: Chronicity of the availability transition. Known values are: - "Transient" and "Persistent". - :paramtype reason_chronicity: str or - ~azure.mgmt.resourcehealth.v2022_10_01.models.ReasonChronicityTypes - :keyword reported_time: Timestamp for when the health was last checked. - :paramtype reported_time: ~datetime.datetime - :keyword recently_resolved: An annotation describing a change in the availabilityState to - Available from Unavailable with a reasonType of type Unplanned. - :paramtype recently_resolved: - ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatusPropertiesRecentlyResolved - :keyword recommended_actions: Lists actions the user can take based on the current - availabilityState of the resource. - :paramtype recommended_actions: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.RecommendedAction] - :keyword service_impacting_events: Lists the service impacting events that may be affecting the - health of the resource. - :paramtype service_impacting_events: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEvent] - """ - super().__init__(**kwargs) - self.availability_state = availability_state - self.title = title - self.summary = summary - self.detailed_status = detailed_status - self.reason_type = reason_type - self.context = context - self.category = category - self.article_id = article_id - self.root_cause_attribution_time = root_cause_attribution_time - self.health_event_type = health_event_type - self.health_event_cause = health_event_cause - self.health_event_category = health_event_category - self.health_event_id = health_event_id - self.resolution_eta = resolution_eta - self.occured_time = occured_time - self.reason_chronicity = reason_chronicity - self.reported_time = reported_time - self.recently_resolved = recently_resolved - self.recommended_actions = recommended_actions - self.service_impacting_events = service_impacting_events - - -class AvailabilityStatusPropertiesRecentlyResolved(_serialization.Model): - """An annotation describing a change in the availabilityState to Available from Unavailable with a - reasonType of type Unplanned. - - :ivar unavailable_occured_time: Timestamp for when the availabilityState changed to - Unavailable. - :vartype unavailable_occured_time: ~datetime.datetime - :ivar resolved_time: Timestamp when the availabilityState changes to Available. - :vartype resolved_time: ~datetime.datetime - :ivar unavailable_summary: Brief description of cause of the resource becoming unavailable. - :vartype unavailable_summary: str - """ - - _attribute_map = { - "unavailable_occured_time": {"key": "unavailableOccuredTime", "type": "iso-8601"}, - "resolved_time": {"key": "resolvedTime", "type": "iso-8601"}, - "unavailable_summary": {"key": "unavailableSummary", "type": "str"}, - } - - def __init__( - self, - *, - unavailable_occured_time: Optional[datetime.datetime] = None, - resolved_time: Optional[datetime.datetime] = None, - unavailable_summary: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword unavailable_occured_time: Timestamp for when the availabilityState changed to - Unavailable. - :paramtype unavailable_occured_time: ~datetime.datetime - :keyword resolved_time: Timestamp when the availabilityState changes to Available. - :paramtype resolved_time: ~datetime.datetime - :keyword unavailable_summary: Brief description of cause of the resource becoming unavailable. - :paramtype unavailable_summary: str - """ - super().__init__(**kwargs) - self.unavailable_occured_time = unavailable_occured_time - self.resolved_time = resolved_time - self.unavailable_summary = unavailable_summary - - -class EmergingIssueImpact(_serialization.Model): - """Object of the emerging issue impact on services and regions. - - :ivar id: The impacted service id. - :vartype id: str - :ivar name: The impacted service name. - :vartype name: str - :ivar regions: The list of impacted regions for corresponding emerging issues. - :vartype regions: list[~azure.mgmt.resourcehealth.v2022_10_01.models.ImpactedRegion] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "regions": {"key": "regions", "type": "[ImpactedRegion]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - regions: Optional[List["_models.ImpactedRegion"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The impacted service id. - :paramtype id: str - :keyword name: The impacted service name. - :paramtype name: str - :keyword regions: The list of impacted regions for corresponding emerging issues. - :paramtype regions: list[~azure.mgmt.resourcehealth.v2022_10_01.models.ImpactedRegion] - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.regions = regions - - -class EmergingIssueListResult(_serialization.Model): - """The list of emerging issues. - - :ivar value: The list of emerging issues. - :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult] - :ivar next_link: The link used to get the next page of emerging issues. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[EmergingIssuesGetResult]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.EmergingIssuesGetResult"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of emerging issues. - :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult] - :keyword next_link: The link used to get the next page of emerging issues. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. 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.resourcehealth.v2022_10_01.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. 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.resourcehealth.v2022_10_01.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - - -class EmergingIssuesGetResult(ProxyResource): - """The Get EmergingIssues operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2022_10_01.models.SystemData - :ivar refresh_timestamp: Timestamp for when last time refreshed for ongoing emerging issue. - :vartype refresh_timestamp: ~datetime.datetime - :ivar status_banners: The list of emerging issues of banner type. - :vartype status_banners: list[~azure.mgmt.resourcehealth.v2022_10_01.models.StatusBanner] - :ivar status_active_events: The list of emerging issues of active event type. - :vartype status_active_events: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.StatusActiveEvent] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "refresh_timestamp": {"key": "properties.refreshTimestamp", "type": "iso-8601"}, - "status_banners": {"key": "properties.statusBanners", "type": "[StatusBanner]"}, - "status_active_events": {"key": "properties.statusActiveEvents", "type": "[StatusActiveEvent]"}, - } - - def __init__( - self, - *, - refresh_timestamp: Optional[datetime.datetime] = None, - status_banners: Optional[List["_models.StatusBanner"]] = None, - status_active_events: Optional[List["_models.StatusActiveEvent"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword refresh_timestamp: Timestamp for when last time refreshed for ongoing emerging issue. - :paramtype refresh_timestamp: ~datetime.datetime - :keyword status_banners: The list of emerging issues of banner type. - :paramtype status_banners: list[~azure.mgmt.resourcehealth.v2022_10_01.models.StatusBanner] - :keyword status_active_events: The list of emerging issues of active event type. - :paramtype status_active_events: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.StatusActiveEvent] - """ - super().__init__(**kwargs) - self.refresh_timestamp = refresh_timestamp - self.status_banners = status_banners - self.status_active_events = status_active_events - - -class ErrorResponse(_serialization.Model): - """Error details. - - 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 details: The error details. - :vartype details: str - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "details": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.details = None - - -class Event(ProxyResource): # pylint: disable=too-many-instance-attributes - """Service health event. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2022_10_01.models.SystemData - :ivar event_type: Type of event. Known values are: "ServiceIssue", "PlannedMaintenance", - "HealthAdvisory", "RCA", "EmergingIssues", and "SecurityAdvisory". - :vartype event_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventTypeValues - :ivar event_source: Source of event. Known values are: "ResourceHealth" and "ServiceHealth". - :vartype event_source: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventSourceValues - :ivar status: Current status of event. Known values are: "Active" and "Resolved". - :vartype status: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventStatusValues - :ivar title: Title text of event. - :vartype title: str - :ivar summary: Summary text of event. - :vartype summary: str - :ivar header: Header text of event. - :vartype header: str - :ivar level: Level of insight. Known values are: "Critical" and "Warning". - :vartype level: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.LevelValues - :ivar event_level: Level of event. Known values are: "Critical", "Error", "Warning", and - "Informational". - :vartype event_level: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventLevelValues - :ivar external_incident_id: The id of the Incident. - :vartype external_incident_id: str - :ivar reason: The reason for the Incident. - :vartype reason: str - :ivar article: Article of event. - :vartype article: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesArticle - :ivar links: Useful links of event. - :vartype links: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Link] - :ivar impact_start_time: It provides the Timestamp for when the health impacting event started. - :vartype impact_start_time: ~datetime.datetime - :ivar impact_mitigation_time: It provides the Timestamp for when the health impacting event - resolved. - :vartype impact_mitigation_time: ~datetime.datetime - :ivar impact: List services impacted by the service health event. - :vartype impact: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Impact] - :ivar recommended_actions: Recommended actions of event. - :vartype recommended_actions: - ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesRecommendedActions - :ivar faqs: Frequently asked questions for the service health event. - :vartype faqs: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Faq] - :ivar is_hir: It provides information if the event is High incident rate event or not. - :vartype is_hir: bool - :ivar enable_microsoft_support: Tells if we want to enable or disable Microsoft Support for - this event. - :vartype enable_microsoft_support: bool - :ivar description: Contains the communication message for the event, that could include - summary, root cause and other details. - :vartype description: str - :ivar platform_initiated: Is true if the event is platform initiated. - :vartype platform_initiated: bool - :ivar enable_chat_with_us: Tells if we want to enable or disable Microsoft Support for this - event. - :vartype enable_chat_with_us: bool - :ivar priority: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. - Service issue events have higher priority followed by planned maintenance and health advisory. - Critical events have higher priority followed by error, warning and informational. Furthermore, - active events have higher priority than resolved. - :vartype priority: int - :ivar last_update_time: It provides the Timestamp for when the health impacting event was last - updated. - :vartype last_update_time: ~datetime.datetime - :ivar hir_stage: Stage for HIR Document. - :vartype hir_stage: str - :ivar additional_information: Additional information. - :vartype additional_information: - ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesAdditionalInformation - :ivar duration: duration in seconds. - :vartype duration: int - :ivar impact_type: The type of the impact. - :vartype impact_type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "event_type": {"key": "properties.eventType", "type": "str"}, - "event_source": {"key": "properties.eventSource", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "title": {"key": "properties.title", "type": "str"}, - "summary": {"key": "properties.summary", "type": "str"}, - "header": {"key": "properties.header", "type": "str"}, - "level": {"key": "properties.level", "type": "str"}, - "event_level": {"key": "properties.eventLevel", "type": "str"}, - "external_incident_id": {"key": "properties.externalIncidentId", "type": "str"}, - "reason": {"key": "properties.reason", "type": "str"}, - "article": {"key": "properties.article", "type": "EventPropertiesArticle"}, - "links": {"key": "properties.links", "type": "[Link]"}, - "impact_start_time": {"key": "properties.impactStartTime", "type": "iso-8601"}, - "impact_mitigation_time": {"key": "properties.impactMitigationTime", "type": "iso-8601"}, - "impact": {"key": "properties.impact", "type": "[Impact]"}, - "recommended_actions": {"key": "properties.recommendedActions", "type": "EventPropertiesRecommendedActions"}, - "faqs": {"key": "properties.faqs", "type": "[Faq]"}, - "is_hir": {"key": "properties.isHIR", "type": "bool"}, - "enable_microsoft_support": {"key": "properties.enableMicrosoftSupport", "type": "bool"}, - "description": {"key": "properties.description", "type": "str"}, - "platform_initiated": {"key": "properties.platformInitiated", "type": "bool"}, - "enable_chat_with_us": {"key": "properties.enableChatWithUs", "type": "bool"}, - "priority": {"key": "properties.priority", "type": "int"}, - "last_update_time": {"key": "properties.lastUpdateTime", "type": "iso-8601"}, - "hir_stage": {"key": "properties.hirStage", "type": "str"}, - "additional_information": { - "key": "properties.additionalInformation", - "type": "EventPropertiesAdditionalInformation", - }, - "duration": {"key": "properties.duration", "type": "int"}, - "impact_type": {"key": "properties.impactType", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - event_type: Optional[Union[str, "_models.EventTypeValues"]] = None, - event_source: Optional[Union[str, "_models.EventSourceValues"]] = None, - status: Optional[Union[str, "_models.EventStatusValues"]] = None, - title: Optional[str] = None, - summary: Optional[str] = None, - header: Optional[str] = None, - level: Optional[Union[str, "_models.LevelValues"]] = None, - event_level: Optional[Union[str, "_models.EventLevelValues"]] = None, - external_incident_id: Optional[str] = None, - reason: Optional[str] = None, - article: Optional["_models.EventPropertiesArticle"] = None, - links: Optional[List["_models.Link"]] = None, - impact_start_time: Optional[datetime.datetime] = None, - impact_mitigation_time: Optional[datetime.datetime] = None, - impact: Optional[List["_models.Impact"]] = None, - recommended_actions: Optional["_models.EventPropertiesRecommendedActions"] = None, - faqs: Optional[List["_models.Faq"]] = None, - is_hir: Optional[bool] = None, - enable_microsoft_support: Optional[bool] = None, - description: Optional[str] = None, - platform_initiated: Optional[bool] = None, - enable_chat_with_us: Optional[bool] = None, - priority: Optional[int] = None, - last_update_time: Optional[datetime.datetime] = None, - hir_stage: Optional[str] = None, - additional_information: Optional["_models.EventPropertiesAdditionalInformation"] = None, - duration: Optional[int] = None, - impact_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword event_type: Type of event. Known values are: "ServiceIssue", "PlannedMaintenance", - "HealthAdvisory", "RCA", "EmergingIssues", and "SecurityAdvisory". - :paramtype event_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventTypeValues - :keyword event_source: Source of event. Known values are: "ResourceHealth" and "ServiceHealth". - :paramtype event_source: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventSourceValues - :keyword status: Current status of event. Known values are: "Active" and "Resolved". - :paramtype status: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventStatusValues - :keyword title: Title text of event. - :paramtype title: str - :keyword summary: Summary text of event. - :paramtype summary: str - :keyword header: Header text of event. - :paramtype header: str - :keyword level: Level of insight. Known values are: "Critical" and "Warning". - :paramtype level: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.LevelValues - :keyword event_level: Level of event. Known values are: "Critical", "Error", "Warning", and - "Informational". - :paramtype event_level: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventLevelValues - :keyword external_incident_id: The id of the Incident. - :paramtype external_incident_id: str - :keyword reason: The reason for the Incident. - :paramtype reason: str - :keyword article: Article of event. - :paramtype article: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesArticle - :keyword links: Useful links of event. - :paramtype links: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Link] - :keyword impact_start_time: It provides the Timestamp for when the health impacting event - started. - :paramtype impact_start_time: ~datetime.datetime - :keyword impact_mitigation_time: It provides the Timestamp for when the health impacting event - resolved. - :paramtype impact_mitigation_time: ~datetime.datetime - :keyword impact: List services impacted by the service health event. - :paramtype impact: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Impact] - :keyword recommended_actions: Recommended actions of event. - :paramtype recommended_actions: - ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesRecommendedActions - :keyword faqs: Frequently asked questions for the service health event. - :paramtype faqs: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Faq] - :keyword is_hir: It provides information if the event is High incident rate event or not. - :paramtype is_hir: bool - :keyword enable_microsoft_support: Tells if we want to enable or disable Microsoft Support for - this event. - :paramtype enable_microsoft_support: bool - :keyword description: Contains the communication message for the event, that could include - summary, root cause and other details. - :paramtype description: str - :keyword platform_initiated: Is true if the event is platform initiated. - :paramtype platform_initiated: bool - :keyword enable_chat_with_us: Tells if we want to enable or disable Microsoft Support for this - event. - :paramtype enable_chat_with_us: bool - :keyword priority: Priority level of the event. Has value from 0 to 23. 0 is the highest - priority. Service issue events have higher priority followed by planned maintenance and health - advisory. Critical events have higher priority followed by error, warning and informational. - Furthermore, active events have higher priority than resolved. - :paramtype priority: int - :keyword last_update_time: It provides the Timestamp for when the health impacting event was - last updated. - :paramtype last_update_time: ~datetime.datetime - :keyword hir_stage: Stage for HIR Document. - :paramtype hir_stage: str - :keyword additional_information: Additional information. - :paramtype additional_information: - ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesAdditionalInformation - :keyword duration: duration in seconds. - :paramtype duration: int - :keyword impact_type: The type of the impact. - :paramtype impact_type: str - """ - super().__init__(**kwargs) - self.event_type = event_type - self.event_source = event_source - self.status = status - self.title = title - self.summary = summary - self.header = header - self.level = level - self.event_level = event_level - self.external_incident_id = external_incident_id - self.reason = reason - self.article = article - self.links = links - self.impact_start_time = impact_start_time - self.impact_mitigation_time = impact_mitigation_time - self.impact = impact - self.recommended_actions = recommended_actions - self.faqs = faqs - self.is_hir = is_hir - self.enable_microsoft_support = enable_microsoft_support - self.description = description - self.platform_initiated = platform_initiated - self.enable_chat_with_us = enable_chat_with_us - self.priority = priority - self.last_update_time = last_update_time - self.hir_stage = hir_stage - self.additional_information = additional_information - self.duration = duration - self.impact_type = impact_type - - -class EventImpactedResource(ProxyResource): - """Impacted resource for an event. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2022_10_01.models.SystemData - :ivar target_resource_type: Resource type within Microsoft cloud. - :vartype target_resource_type: str - :ivar target_resource_id: Identity for resource within Microsoft cloud. - :vartype target_resource_id: str - :ivar target_region: Impacted resource region name. - :vartype target_region: str - :ivar info: Additional information. - :vartype info: list[~azure.mgmt.resourcehealth.v2022_10_01.models.KeyValueItem] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "target_resource_type": {"readonly": True}, - "target_resource_id": {"readonly": True}, - "target_region": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "target_resource_type": {"key": "properties.targetResourceType", "type": "str"}, - "target_resource_id": {"key": "properties.targetResourceId", "type": "str"}, - "target_region": {"key": "properties.targetRegion", "type": "str"}, - "info": {"key": "properties.info", "type": "[KeyValueItem]"}, - } - - def __init__(self, *, info: Optional[List["_models.KeyValueItem"]] = None, **kwargs: Any) -> None: - """ - :keyword info: Additional information. - :paramtype info: list[~azure.mgmt.resourcehealth.v2022_10_01.models.KeyValueItem] - """ - super().__init__(**kwargs) - self.target_resource_type = None - self.target_resource_id = None - self.target_region = None - self.info = info - - -class EventImpactedResourceListResult(_serialization.Model): - """The List of eventImpactedResources operation response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The list of eventImpactedResources. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] - :ivar next_link: The URI to fetch the next page of events. Call ListNext() with this URI to - fetch the next page of impacted resource. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[EventImpactedResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.EventImpactedResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of eventImpactedResources. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] - :keyword next_link: The URI to fetch the next page of events. Call ListNext() with this URI to - fetch the next page of impacted resource. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class EventPropertiesAdditionalInformation(_serialization.Model): - """Additional information. - - :ivar message: Additional information Message. - :vartype message: str - """ - - _attribute_map = { - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword message: Additional information Message. - :paramtype message: str - """ - super().__init__(**kwargs) - self.message = message - - -class EventPropertiesArticle(_serialization.Model): - """Article of event. - - :ivar article_content: Article content of event. - :vartype article_content: str - :ivar article_id: Article Id. - :vartype article_id: str - :ivar parameters: It provides a map of parameter name and value. - :vartype parameters: JSON - """ - - _attribute_map = { - "article_content": {"key": "articleContent", "type": "str"}, - "article_id": {"key": "articleId", "type": "str"}, - "parameters": {"key": "parameters", "type": "object"}, - } - - def __init__( - self, - *, - article_content: Optional[str] = None, - article_id: Optional[str] = None, - parameters: Optional[JSON] = None, - **kwargs: Any - ) -> None: - """ - :keyword article_content: Article content of event. - :paramtype article_content: str - :keyword article_id: Article Id. - :paramtype article_id: str - :keyword parameters: It provides a map of parameter name and value. - :paramtype parameters: JSON - """ - super().__init__(**kwargs) - self.article_content = article_content - self.article_id = article_id - self.parameters = parameters - - -class EventPropertiesRecommendedActions(_serialization.Model): - """Recommended actions of event. - - :ivar message: Recommended action title for the service health event. - :vartype message: str - :ivar actions: Recommended actions for the service health event. - :vartype actions: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesRecommendedActionsItem] - :ivar locale_code: Recommended action locale for the service health event. - :vartype locale_code: str - """ - - _attribute_map = { - "message": {"key": "message", "type": "str"}, - "actions": {"key": "actions", "type": "[EventPropertiesRecommendedActionsItem]"}, - "locale_code": {"key": "localeCode", "type": "str"}, - } - - def __init__( - self, - *, - message: Optional[str] = None, - actions: Optional[List["_models.EventPropertiesRecommendedActionsItem"]] = None, - locale_code: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword message: Recommended action title for the service health event. - :paramtype message: str - :keyword actions: Recommended actions for the service health event. - :paramtype actions: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesRecommendedActionsItem] - :keyword locale_code: Recommended action locale for the service health event. - :paramtype locale_code: str - """ - super().__init__(**kwargs) - self.message = message - self.actions = actions - self.locale_code = locale_code - - -class EventPropertiesRecommendedActionsItem(_serialization.Model): - """Recommended action for the service health event. - - :ivar group_id: Recommended action group Id for the service health event. - :vartype group_id: int - :ivar action_text: Recommended action text. - :vartype action_text: str - """ - - _attribute_map = { - "group_id": {"key": "groupId", "type": "int"}, - "action_text": {"key": "actionText", "type": "str"}, - } - - def __init__(self, *, group_id: Optional[int] = None, action_text: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword group_id: Recommended action group Id for the service health event. - :paramtype group_id: int - :keyword action_text: Recommended action text. - :paramtype action_text: str - """ - super().__init__(**kwargs) - self.group_id = group_id - self.action_text = action_text - - -class Events(_serialization.Model): - """The List events operation response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The list of event. Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] - :ivar next_link: The URI to fetch the next page of events. Call ListNext() with this URI to - fetch the next page of events. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Event]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Event"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of event. Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] - :keyword next_link: The URI to fetch the next page of events. Call ListNext() with this URI to - fetch the next page of events. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Faq(_serialization.Model): - """Frequently asked question for the service health event. - - :ivar question: FAQ question for the service health event. - :vartype question: str - :ivar answer: FAQ answer for the service health event. - :vartype answer: str - :ivar locale_code: FAQ locale for the service health event. - :vartype locale_code: str - """ - - _attribute_map = { - "question": {"key": "question", "type": "str"}, - "answer": {"key": "answer", "type": "str"}, - "locale_code": {"key": "localeCode", "type": "str"}, - } - - def __init__( - self, - *, - question: Optional[str] = None, - answer: Optional[str] = None, - locale_code: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword question: FAQ question for the service health event. - :paramtype question: str - :keyword answer: FAQ answer for the service health event. - :paramtype answer: str - :keyword locale_code: FAQ locale for the service health event. - :paramtype locale_code: str - """ - super().__init__(**kwargs) - self.question = question - self.answer = answer - self.locale_code = locale_code - - -class Impact(_serialization.Model): - """Azure service impacted by the service health event. - - :ivar impacted_service: Impacted service name. - :vartype impacted_service: str - :ivar impacted_regions: List regions impacted by the service health event. - :vartype impacted_regions: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.ImpactedServiceRegion] - """ - - _attribute_map = { - "impacted_service": {"key": "impactedService", "type": "str"}, - "impacted_regions": {"key": "impactedRegions", "type": "[ImpactedServiceRegion]"}, - } - - def __init__( - self, - *, - impacted_service: Optional[str] = None, - impacted_regions: Optional[List["_models.ImpactedServiceRegion"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword impacted_service: Impacted service name. - :paramtype impacted_service: str - :keyword impacted_regions: List regions impacted by the service health event. - :paramtype impacted_regions: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.ImpactedServiceRegion] - """ - super().__init__(**kwargs) - self.impacted_service = impacted_service - self.impacted_regions = impacted_regions - - -class ImpactedRegion(_serialization.Model): - """Object of impacted region. - - :ivar id: The impacted region id. - :vartype id: str - :ivar name: The impacted region name. - :vartype name: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The impacted region id. - :paramtype id: str - :keyword name: The impacted region name. - :paramtype name: str - """ - super().__init__(**kwargs) - self.id = id - self.name = name - - -class ImpactedResourceStatus(ProxyResource): - """impactedResource with health status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2022_10_01.models.SystemData - :ivar availability_state: Impacted resource status of the resource. Known values are: - "Available", "Unavailable", "Degraded", and "Unknown". - :vartype availability_state: str or - ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStateValues - :ivar title: Title description of the impacted resource status. - :vartype title: str - :ivar summary: Summary description of the impacted resource status. - :vartype summary: str - :ivar reason_type: When the resource's availabilityState is Unavailable, it describes where the - health impacting event was originated. Known values are: "Unplanned", "Planned", and - "UserInitiated". - :vartype reason_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.ReasonTypeValues - :ivar occurred_time: Timestamp for when last change in health status occurred. - :vartype occurred_time: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "availability_state": {"key": "properties.availabilityState", "type": "str"}, - "title": {"key": "properties.title", "type": "str"}, - "summary": {"key": "properties.summary", "type": "str"}, - "reason_type": {"key": "properties.reasonType", "type": "str"}, - "occurred_time": {"key": "properties.occurredTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - availability_state: Optional[Union[str, "_models.AvailabilityStateValues"]] = None, - title: Optional[str] = None, - summary: Optional[str] = None, - reason_type: Optional[Union[str, "_models.ReasonTypeValues"]] = None, - occurred_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword availability_state: Impacted resource status of the resource. Known values are: - "Available", "Unavailable", "Degraded", and "Unknown". - :paramtype availability_state: str or - ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStateValues - :keyword title: Title description of the impacted resource status. - :paramtype title: str - :keyword summary: Summary description of the impacted resource status. - :paramtype summary: str - :keyword reason_type: When the resource's availabilityState is Unavailable, it describes where - the health impacting event was originated. Known values are: "Unplanned", "Planned", and - "UserInitiated". - :paramtype reason_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.ReasonTypeValues - :keyword occurred_time: Timestamp for when last change in health status occurred. - :paramtype occurred_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.availability_state = availability_state - self.title = title - self.summary = summary - self.reason_type = reason_type - self.occurred_time = occurred_time - - -class ImpactedServiceRegion(_serialization.Model): - """Azure region impacted by the service health event. - - :ivar impacted_region: Impacted region name. - :vartype impacted_region: str - :ivar status: Current status of event in the region. Known values are: "Active" and "Resolved". - :vartype status: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventStatusValues - :ivar impacted_subscriptions: List subscription impacted by the service health event. - :vartype impacted_subscriptions: list[str] - :ivar impacted_tenants: List tenant impacted by the service health event. - :vartype impacted_tenants: list[str] - :ivar last_update_time: It provides the Timestamp for when the last update for the service - health event. - :vartype last_update_time: ~datetime.datetime - :ivar updates: List of updates for given service health event. - :vartype updates: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Update] - """ - - _attribute_map = { - "impacted_region": {"key": "impactedRegion", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "impacted_subscriptions": {"key": "impactedSubscriptions", "type": "[str]"}, - "impacted_tenants": {"key": "impactedTenants", "type": "[str]"}, - "last_update_time": {"key": "lastUpdateTime", "type": "iso-8601"}, - "updates": {"key": "updates", "type": "[Update]"}, - } - - def __init__( - self, - *, - impacted_region: Optional[str] = None, - status: Optional[Union[str, "_models.EventStatusValues"]] = None, - impacted_subscriptions: Optional[List[str]] = None, - impacted_tenants: Optional[List[str]] = None, - last_update_time: Optional[datetime.datetime] = None, - updates: Optional[List["_models.Update"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword impacted_region: Impacted region name. - :paramtype impacted_region: str - :keyword status: Current status of event in the region. Known values are: "Active" and - "Resolved". - :paramtype status: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventStatusValues - :keyword impacted_subscriptions: List subscription impacted by the service health event. - :paramtype impacted_subscriptions: list[str] - :keyword impacted_tenants: List tenant impacted by the service health event. - :paramtype impacted_tenants: list[str] - :keyword last_update_time: It provides the Timestamp for when the last update for the service - health event. - :paramtype last_update_time: ~datetime.datetime - :keyword updates: List of updates for given service health event. - :paramtype updates: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Update] - """ - super().__init__(**kwargs) - self.impacted_region = impacted_region - self.status = status - self.impacted_subscriptions = impacted_subscriptions - self.impacted_tenants = impacted_tenants - self.last_update_time = last_update_time - self.updates = updates - - -class KeyValueItem(_serialization.Model): - """Key value tuple. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key: Key of tuple. - :vartype key: str - :ivar value: Value of tuple. - :vartype value: str - """ - - _validation = { - "key": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "key": {"key": "key", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.key = None - self.value = None - - -class Link(_serialization.Model): - """Useful links for service health event. - - :ivar type: Type of link. Known values are: "Button" and "Hyperlink". - :vartype type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.LinkTypeValues - :ivar display_text: Display text of link. - :vartype display_text: ~azure.mgmt.resourcehealth.v2022_10_01.models.LinkDisplayText - :ivar extension_name: It provides the name of portal extension to produce link for given - service health event. - :vartype extension_name: str - :ivar blade_name: It provides the name of portal extension blade to produce link for given - service health event. - :vartype blade_name: str - :ivar parameters: It provides a map of parameter name and value for portal extension blade to - produce lik for given service health event. - :vartype parameters: JSON - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "display_text": {"key": "displayText", "type": "LinkDisplayText"}, - "extension_name": {"key": "extensionName", "type": "str"}, - "blade_name": {"key": "bladeName", "type": "str"}, - "parameters": {"key": "parameters", "type": "object"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.LinkTypeValues"]] = None, - display_text: Optional["_models.LinkDisplayText"] = None, - extension_name: Optional[str] = None, - blade_name: Optional[str] = None, - parameters: Optional[JSON] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of link. Known values are: "Button" and "Hyperlink". - :paramtype type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.LinkTypeValues - :keyword display_text: Display text of link. - :paramtype display_text: ~azure.mgmt.resourcehealth.v2022_10_01.models.LinkDisplayText - :keyword extension_name: It provides the name of portal extension to produce link for given - service health event. - :paramtype extension_name: str - :keyword blade_name: It provides the name of portal extension blade to produce link for given - service health event. - :paramtype blade_name: str - :keyword parameters: It provides a map of parameter name and value for portal extension blade - to produce lik for given service health event. - :paramtype parameters: JSON - """ - super().__init__(**kwargs) - self.type = type - self.display_text = display_text - self.extension_name = extension_name - self.blade_name = blade_name - self.parameters = parameters - - -class LinkDisplayText(_serialization.Model): - """Display text of link. - - :ivar value: Display text of link. - :vartype value: str - :ivar localized_value: Localized display text of link. - :vartype localized_value: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Display text of link. - :paramtype value: str - :keyword localized_value: Localized display text of link. - :paramtype localized_value: str - """ - super().__init__(**kwargs) - self.value = value - self.localized_value = localized_value - - -class MetadataEntity(ProxyResource): - """The metadata entity contract. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resourcehealth.v2022_10_01.models.SystemData - :ivar display_name: The display name. - :vartype display_name: str - :ivar depends_on: The list of keys on which this entity depends on. - :vartype depends_on: list[str] - :ivar applicable_scenarios: The list of scenarios applicable to this metadata entity. - :vartype applicable_scenarios: list[str or - ~azure.mgmt.resourcehealth.v2022_10_01.models.Scenario] - :ivar supported_values: The list of supported values. - :vartype supported_values: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataSupportedValueDetail] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "depends_on": {"key": "properties.dependsOn", "type": "[str]"}, - "applicable_scenarios": {"key": "properties.applicableScenarios", "type": "[str]"}, - "supported_values": {"key": "properties.supportedValues", "type": "[MetadataSupportedValueDetail]"}, - } - - def __init__( - self, - *, - display_name: Optional[str] = None, - depends_on: Optional[List[str]] = None, - applicable_scenarios: Optional[List[Union[str, "_models.Scenario"]]] = None, - supported_values: Optional[List["_models.MetadataSupportedValueDetail"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword display_name: The display name. - :paramtype display_name: str - :keyword depends_on: The list of keys on which this entity depends on. - :paramtype depends_on: list[str] - :keyword applicable_scenarios: The list of scenarios applicable to this metadata entity. - :paramtype applicable_scenarios: list[str or - ~azure.mgmt.resourcehealth.v2022_10_01.models.Scenario] - :keyword supported_values: The list of supported values. - :paramtype supported_values: - list[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataSupportedValueDetail] - """ - super().__init__(**kwargs) - self.display_name = display_name - self.depends_on = depends_on - self.applicable_scenarios = applicable_scenarios - self.supported_values = supported_values - - -class MetadataEntityListResult(_serialization.Model): - """The list of metadata entities. - - :ivar value: The list of metadata entities. - :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity] - :ivar next_link: The link used to get the next page of metadata. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MetadataEntity]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.MetadataEntity"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of metadata entities. - :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity] - :keyword next_link: The link used to get the next page of metadata. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MetadataSupportedValueDetail(_serialization.Model): - """The metadata supported value detail. - - :ivar id: The id. - :vartype id: str - :ivar display_name: The display name. - :vartype display_name: str - :ivar resource_types: The list of associated resource types. - :vartype resource_types: list[str] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "resource_types": {"key": "resourceTypes", "type": "[str]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - display_name: Optional[str] = None, - resource_types: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id. - :paramtype id: str - :keyword display_name: The display name. - :paramtype display_name: str - :keyword resource_types: The list of associated resource types. - :paramtype resource_types: list[str] - """ - super().__init__(**kwargs) - self.id = id - self.display_name = display_name - self.resource_types = resource_types - - -class Operation(_serialization.Model): - """Operation available in the Microsoft.ResourceHealth resource provider. - - :ivar name: Name of the operation. - :vartype name: str - :ivar display: Properties of the operation. - :vartype display: ~azure.mgmt.resourcehealth.v2022_10_01.models.OperationDisplay - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, - } - - def __init__( - self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any - ) -> None: - """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword display: Properties of the operation. - :paramtype display: ~azure.mgmt.resourcehealth.v2022_10_01.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(_serialization.Model): - """Properties of the operation. - - :ivar provider: Provider name. - :vartype provider: str - :ivar resource: Resource name. - :vartype resource: str - :ivar operation: Operation name. - :vartype operation: str - :ivar description: Description of the operation. - :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: Provider name. - :paramtype provider: str - :keyword resource: Resource name. - :paramtype resource: str - :keyword operation: Operation name. - :paramtype operation: str - :keyword description: Description of the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationListResult(_serialization.Model): - """Lists the operations response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: List of operations available in the Microsoft.ResourceHealth resource provider. - Required. - :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Operation] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - } - - def __init__(self, *, value: List["_models.Operation"], **kwargs: Any) -> None: - """ - :keyword value: List of operations available in the Microsoft.ResourceHealth resource provider. - Required. - :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Operation] - """ - super().__init__(**kwargs) - self.value = value - - -class RecommendedAction(_serialization.Model): - """Lists actions the user can take based on the current availabilityState of the resource. - - :ivar action: Recommended action. - :vartype action: str - :ivar action_url: Link to the action. - :vartype action_url: str - :ivar action_url_comment: the comment for the Action. - :vartype action_url_comment: str - :ivar action_url_text: Substring of action, it describes which text should host the action URL. - :vartype action_url_text: str - """ - - _attribute_map = { - "action": {"key": "action", "type": "str"}, - "action_url": {"key": "actionUrl", "type": "str"}, - "action_url_comment": {"key": "_ActionUrl\\.Comment", "type": "str"}, - "action_url_text": {"key": "actionUrlText", "type": "str"}, - } - - def __init__( - self, - *, - action: Optional[str] = None, - action_url: Optional[str] = None, - action_url_comment: Optional[str] = None, - action_url_text: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword action: Recommended action. - :paramtype action: str - :keyword action_url: Link to the action. - :paramtype action_url: str - :keyword action_url_comment: the comment for the Action. - :paramtype action_url_comment: str - :keyword action_url_text: Substring of action, it describes which text should host the action - URL. - :paramtype action_url_text: str - """ - super().__init__(**kwargs) - self.action = action - self.action_url = action_url - self.action_url_comment = action_url_comment - self.action_url_text = action_url_text - - -class ServiceImpactingEvent(_serialization.Model): - """Lists the service impacting events that may be affecting the health of the resource. - - :ivar event_start_time: Timestamp for when the event started. - :vartype event_start_time: ~datetime.datetime - :ivar event_status_last_modified_time: Timestamp for when event was submitted/detected. - :vartype event_status_last_modified_time: ~datetime.datetime - :ivar correlation_id: Correlation id for the event. - :vartype correlation_id: str - :ivar status: Status of the service impacting event. - :vartype status: ~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEventStatus - :ivar incident_properties: Properties of the service impacting event. - :vartype incident_properties: - ~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEventIncidentProperties - """ - - _attribute_map = { - "event_start_time": {"key": "eventStartTime", "type": "iso-8601"}, - "event_status_last_modified_time": {"key": "eventStatusLastModifiedTime", "type": "iso-8601"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - "status": {"key": "status", "type": "ServiceImpactingEventStatus"}, - "incident_properties": {"key": "incidentProperties", "type": "ServiceImpactingEventIncidentProperties"}, - } - - def __init__( - self, - *, - event_start_time: Optional[datetime.datetime] = None, - event_status_last_modified_time: Optional[datetime.datetime] = None, - correlation_id: Optional[str] = None, - status: Optional["_models.ServiceImpactingEventStatus"] = None, - incident_properties: Optional["_models.ServiceImpactingEventIncidentProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword event_start_time: Timestamp for when the event started. - :paramtype event_start_time: ~datetime.datetime - :keyword event_status_last_modified_time: Timestamp for when event was submitted/detected. - :paramtype event_status_last_modified_time: ~datetime.datetime - :keyword correlation_id: Correlation id for the event. - :paramtype correlation_id: str - :keyword status: Status of the service impacting event. - :paramtype status: ~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEventStatus - :keyword incident_properties: Properties of the service impacting event. - :paramtype incident_properties: - ~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEventIncidentProperties - """ - super().__init__(**kwargs) - self.event_start_time = event_start_time - self.event_status_last_modified_time = event_status_last_modified_time - self.correlation_id = correlation_id - self.status = status - self.incident_properties = incident_properties - - -class ServiceImpactingEventIncidentProperties(_serialization.Model): - """Properties of the service impacting event. - - :ivar title: Title of the incident. - :vartype title: str - :ivar service: Service impacted by the event. - :vartype service: str - :ivar region: Region impacted by the event. - :vartype region: str - :ivar incident_type: Type of Event. - :vartype incident_type: str - """ - - _attribute_map = { - "title": {"key": "title", "type": "str"}, - "service": {"key": "service", "type": "str"}, - "region": {"key": "region", "type": "str"}, - "incident_type": {"key": "incidentType", "type": "str"}, - } - - def __init__( - self, - *, - title: Optional[str] = None, - service: Optional[str] = None, - region: Optional[str] = None, - incident_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword title: Title of the incident. - :paramtype title: str - :keyword service: Service impacted by the event. - :paramtype service: str - :keyword region: Region impacted by the event. - :paramtype region: str - :keyword incident_type: Type of Event. - :paramtype incident_type: str - """ - super().__init__(**kwargs) - self.title = title - self.service = service - self.region = region - self.incident_type = incident_type - - -class ServiceImpactingEventStatus(_serialization.Model): - """Status of the service impacting event. - - :ivar value: Current status of the event. - :vartype value: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Current status of the event. - :paramtype value: str - """ - super().__init__(**kwargs) - self.value = value - - -class StatusActiveEvent(_serialization.Model): - """Active event type of emerging issue. - - :ivar title: The active event title. - :vartype title: str - :ivar description: The details of active event. - :vartype description: str - :ivar tracking_id: The tracking id of this active event. - :vartype tracking_id: str - :ivar start_time: The impact start time on this active event. - :vartype start_time: ~datetime.datetime - :ivar cloud: The cloud type of this active event. - :vartype cloud: str - :ivar severity: The severity level of this active event. Known values are: "Information", - "Warning", and "Error". - :vartype severity: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.SeverityValues - :ivar stage: The stage of this active event. Known values are: "Active", "Resolve", and - "Archived". - :vartype stage: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.StageValues - :ivar published: The boolean value of this active event if published or not. - :vartype published: bool - :ivar last_modified_time: The last time modified on this banner. - :vartype last_modified_time: ~datetime.datetime - :ivar impacts: The list of emerging issues impacts. - :vartype impacts: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssueImpact] - """ - - _attribute_map = { - "title": {"key": "title", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "tracking_id": {"key": "trackingId", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "cloud": {"key": "cloud", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "stage": {"key": "stage", "type": "str"}, - "published": {"key": "published", "type": "bool"}, - "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, - "impacts": {"key": "impacts", "type": "[EmergingIssueImpact]"}, - } - - def __init__( - self, - *, - title: Optional[str] = None, - description: Optional[str] = None, - tracking_id: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - cloud: Optional[str] = None, - severity: Optional[Union[str, "_models.SeverityValues"]] = None, - stage: Optional[Union[str, "_models.StageValues"]] = None, - published: Optional[bool] = None, - last_modified_time: Optional[datetime.datetime] = None, - impacts: Optional[List["_models.EmergingIssueImpact"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword title: The active event title. - :paramtype title: str - :keyword description: The details of active event. - :paramtype description: str - :keyword tracking_id: The tracking id of this active event. - :paramtype tracking_id: str - :keyword start_time: The impact start time on this active event. - :paramtype start_time: ~datetime.datetime - :keyword cloud: The cloud type of this active event. - :paramtype cloud: str - :keyword severity: The severity level of this active event. Known values are: "Information", - "Warning", and "Error". - :paramtype severity: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.SeverityValues - :keyword stage: The stage of this active event. Known values are: "Active", "Resolve", and - "Archived". - :paramtype stage: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.StageValues - :keyword published: The boolean value of this active event if published or not. - :paramtype published: bool - :keyword last_modified_time: The last time modified on this banner. - :paramtype last_modified_time: ~datetime.datetime - :keyword impacts: The list of emerging issues impacts. - :paramtype impacts: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssueImpact] - """ - super().__init__(**kwargs) - self.title = title - self.description = description - self.tracking_id = tracking_id - self.start_time = start_time - self.cloud = cloud - self.severity = severity - self.stage = stage - self.published = published - self.last_modified_time = last_modified_time - self.impacts = impacts - - -class StatusBanner(_serialization.Model): - """Banner type of emerging issue. - - :ivar title: The banner title. - :vartype title: str - :ivar message: The details of banner. - :vartype message: str - :ivar cloud: The cloud type of this banner. - :vartype cloud: str - :ivar last_modified_time: The last time modified on this banner. - :vartype last_modified_time: ~datetime.datetime - """ - - _attribute_map = { - "title": {"key": "title", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "cloud": {"key": "cloud", "type": "str"}, - "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - title: Optional[str] = None, - message: Optional[str] = None, - cloud: Optional[str] = None, - last_modified_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword title: The banner title. - :paramtype title: str - :keyword message: The details of banner. - :paramtype message: str - :keyword cloud: The cloud type of this banner. - :paramtype cloud: str - :keyword last_modified_time: The last time modified on this banner. - :paramtype last_modified_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.title = title - self.message = message - self.cloud = cloud - self.last_modified_time = last_modified_time - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.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.resourcehealth.v2022_10_01.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.resourcehealth.v2022_10_01.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.resourcehealth.v2022_10_01.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 Update(_serialization.Model): - """Update for service health event. - - :ivar summary: Summary text for the given update for the service health event. - :vartype summary: str - :ivar update_date_time: It provides the Timestamp for the given update for the service health - event. - :vartype update_date_time: ~datetime.datetime - """ - - _attribute_map = { - "summary": {"key": "summary", "type": "str"}, - "update_date_time": {"key": "updateDateTime", "type": "iso-8601"}, - } - - def __init__( - self, *, summary: Optional[str] = None, update_date_time: Optional[datetime.datetime] = None, **kwargs: Any - ) -> None: - """ - :keyword summary: Summary text for the given update for the service health event. - :paramtype summary: str - :keyword update_date_time: It provides the Timestamp for the given update for the service - health event. - :paramtype update_date_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.summary = summary - self.update_date_time = update_date_time diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_resource_health_mgmt_client_enums.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_resource_health_mgmt_client_enums.py deleted file mode 100644 index 84a38989e29b..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_resource_health_mgmt_client_enums.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class AvailabilityStateValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Impacted resource status of the resource.""" - - AVAILABLE = "Available" - UNAVAILABLE = "Unavailable" - DEGRADED = "Degraded" - UNKNOWN = "Unknown" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class EventLevelValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Level of event.""" - - CRITICAL = "Critical" - ERROR = "Error" - WARNING = "Warning" - INFORMATIONAL = "Informational" - - -class EventSourceValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Source of event.""" - - RESOURCE_HEALTH = "ResourceHealth" - SERVICE_HEALTH = "ServiceHealth" - - -class EventStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Current status of event.""" - - ACTIVE = "Active" - RESOLVED = "Resolved" - - -class EventTypeValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of event.""" - - SERVICE_ISSUE = "ServiceIssue" - PLANNED_MAINTENANCE = "PlannedMaintenance" - HEALTH_ADVISORY = "HealthAdvisory" - RCA = "RCA" - EMERGING_ISSUES = "EmergingIssues" - SECURITY_ADVISORY = "SecurityAdvisory" - - -class IssueNameParameter(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """IssueNameParameter.""" - - DEFAULT = "default" - - -class LevelValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Level of insight.""" - - CRITICAL = "Critical" - WARNING = "Warning" - - -class LinkTypeValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of link.""" - - BUTTON = "Button" - HYPERLINK = "Hyperlink" - - -class ReasonChronicityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Chronicity of the availability transition.""" - - TRANSIENT = "Transient" - PERSISTENT = "Persistent" - - -class ReasonTypeValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """When the resource's availabilityState is Unavailable, it describes where the health impacting - event was originated. - """ - - UNPLANNED = "Unplanned" - PLANNED = "Planned" - USER_INITIATED = "UserInitiated" - - -class Scenario(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scenario.""" - - ALERTS = "Alerts" - - -class SeverityValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The severity level of this active event.""" - - INFORMATION = "Information" - WARNING = "Warning" - ERROR = "Error" - - -class StageValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The stage of this active event.""" - - ACTIVE = "Active" - RESOLVE = "Resolve" - ARCHIVED = "Archived" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_resources_operations.py deleted file mode 100644 index a50935eb74a3..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_resources_operations.py +++ /dev/null @@ -1,186 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2022-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ChildResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s - :attr:`child_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the all the children and its current health status for a parent resource. Use the - nextLink property in the response to get the next page of children current health. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support not nested parent resource type: - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] - :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._api_version or "2022-10-01")) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_metadata_operations.py deleted file mode 100644 index 679f9865e495..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_metadata_operations.py +++ /dev/null @@ -1,237 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/metadata") - - # 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_entity_request(name: 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", "2022-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/metadata/{name}") - path_format_arguments = { - "name": _SERIALIZER.url("name", 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) - - -class MetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s - :attr:`metadata` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.MetadataEntity"]: - """Gets the list of metadata entities. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MetadataEntity or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity] - :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._api_version or "2022-10-01")) - cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MetadataEntityListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} - - @distributed_trace - def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: - """Gets the list of metadata entities. - - :param name: Name of metadata entity. Required. - :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MetadataEntity or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) - cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) - - request = build_get_entity_request( - name=name, - api_version=api_version, - template_url=self.get_entity.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetadataEntity", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_operations.py deleted file mode 100644 index 72cd36ec1aa9..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_operations.py +++ /dev/null @@ -1,127 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> _models.OperationListResult: - """Lists available operations for the resourcehealth resource provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.OperationListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _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("OperationListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/py.typed b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/__init__.py deleted file mode 100644 index f1e7a4fdd09e..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/__init__.py +++ /dev/null @@ -1,26 +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 ._resource_health_mgmt_client import ResourceHealthMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ResourceHealthMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_configuration.py deleted file mode 100644 index e435fb2605e4..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_configuration.py +++ /dev/null @@ -1,66 +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 typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ResourceHealthMgmtClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-10-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_metadata.json deleted file mode 100644 index 98086c039d39..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_metadata.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "chosen_version": "2023-10-01-preview", - "total_api_version_list": ["2023-10-01-preview"], - "client": { - "name": "ResourceHealthMgmtClient", - "filename": "_resource_health_mgmt_client", - "description": "The Resource Health Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "availability_statuses": "AvailabilityStatusesOperations", - "operations": "Operations", - "metadata": "MetadataOperations", - "impacted_resources": "ImpactedResourcesOperations", - "security_advisory_impacted_resources": "SecurityAdvisoryImpactedResourcesOperations", - "events": "EventsOperations", - "event": "EventOperations", - "child_availability_statuses": "ChildAvailabilityStatusesOperations", - "child_resources": "ChildResourcesOperations", - "emerging_issues": "EmergingIssuesOperations" - } -} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_resource_health_mgmt_client.py deleted file mode 100644 index 81f1a9e79cb4..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_resource_health_mgmt_client.py +++ /dev/null @@ -1,154 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ResourceHealthMgmtClientConfiguration -from .operations import ( - AvailabilityStatusesOperations, - ChildAvailabilityStatusesOperations, - ChildResourcesOperations, - EmergingIssuesOperations, - EventOperations, - EventsOperations, - ImpactedResourcesOperations, - MetadataOperations, - Operations, - SecurityAdvisoryImpactedResourcesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """The Resource Health Client. - - :ivar availability_statuses: AvailabilityStatusesOperations operations - :vartype availability_statuses: - azure.mgmt.resourcehealth.v2023_10_01_preview.operations.AvailabilityStatusesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resourcehealth.v2023_10_01_preview.operations.Operations - :ivar metadata: MetadataOperations operations - :vartype metadata: azure.mgmt.resourcehealth.v2023_10_01_preview.operations.MetadataOperations - :ivar impacted_resources: ImpactedResourcesOperations operations - :vartype impacted_resources: - azure.mgmt.resourcehealth.v2023_10_01_preview.operations.ImpactedResourcesOperations - :ivar security_advisory_impacted_resources: SecurityAdvisoryImpactedResourcesOperations - operations - :vartype security_advisory_impacted_resources: - azure.mgmt.resourcehealth.v2023_10_01_preview.operations.SecurityAdvisoryImpactedResourcesOperations - :ivar events: EventsOperations operations - :vartype events: azure.mgmt.resourcehealth.v2023_10_01_preview.operations.EventsOperations - :ivar event: EventOperations operations - :vartype event: azure.mgmt.resourcehealth.v2023_10_01_preview.operations.EventOperations - :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations - :vartype child_availability_statuses: - azure.mgmt.resourcehealth.v2023_10_01_preview.operations.ChildAvailabilityStatusesOperations - :ivar child_resources: ChildResourcesOperations operations - :vartype child_resources: - azure.mgmt.resourcehealth.v2023_10_01_preview.operations.ChildResourcesOperations - :ivar emerging_issues: EmergingIssuesOperations operations - :vartype emerging_issues: - azure.mgmt.resourcehealth.v2023_10_01_preview.operations.EmergingIssuesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ResourceHealthMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.availability_statuses = AvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.metadata = MetadataOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.impacted_resources = ImpactedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.security_advisory_impacted_resources = SecurityAdvisoryImpactedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.events = EventsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.event = EventOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.child_availability_statuses = ChildAvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.child_resources = ChildResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.emerging_issues = EmergingIssuesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "ResourceHealthMgmtClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_vendor.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_version.py deleted file mode 100644 index 9cf33092d41b..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b5" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/__init__.py deleted file mode 100644 index d95ad182aa0f..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +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 ._resource_health_mgmt_client import ResourceHealthMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ResourceHealthMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_configuration.py deleted file mode 100644 index 8d5320353c3d..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +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 typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ResourceHealthMgmtClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-10-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_resource_health_mgmt_client.py deleted file mode 100644 index 390c59ffdbf2..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/_resource_health_mgmt_client.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ResourceHealthMgmtClientConfiguration -from .operations import ( - AvailabilityStatusesOperations, - ChildAvailabilityStatusesOperations, - ChildResourcesOperations, - EmergingIssuesOperations, - EventOperations, - EventsOperations, - ImpactedResourcesOperations, - MetadataOperations, - Operations, - SecurityAdvisoryImpactedResourcesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """The Resource Health Client. - - :ivar availability_statuses: AvailabilityStatusesOperations operations - :vartype availability_statuses: - azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.AvailabilityStatusesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.Operations - :ivar metadata: MetadataOperations operations - :vartype metadata: - azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.MetadataOperations - :ivar impacted_resources: ImpactedResourcesOperations operations - :vartype impacted_resources: - azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.ImpactedResourcesOperations - :ivar security_advisory_impacted_resources: SecurityAdvisoryImpactedResourcesOperations - operations - :vartype security_advisory_impacted_resources: - azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.SecurityAdvisoryImpactedResourcesOperations - :ivar events: EventsOperations operations - :vartype events: azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.EventsOperations - :ivar event: EventOperations operations - :vartype event: azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.EventOperations - :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations - :vartype child_availability_statuses: - azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.ChildAvailabilityStatusesOperations - :ivar child_resources: ChildResourcesOperations operations - :vartype child_resources: - azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.ChildResourcesOperations - :ivar emerging_issues: EmergingIssuesOperations operations - :vartype emerging_issues: - azure.mgmt.resourcehealth.v2023_10_01_preview.aio.operations.EmergingIssuesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ResourceHealthMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.availability_statuses = AvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.metadata = MetadataOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.impacted_resources = ImpactedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.security_advisory_impacted_resources = SecurityAdvisoryImpactedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.events = EventsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.event = EventOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.child_availability_statuses = ChildAvailabilityStatusesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.child_resources = ChildResourcesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - self.emerging_issues = EmergingIssuesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "ResourceHealthMgmtClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/__init__.py deleted file mode 100644 index 5ef1b5084a40..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,37 +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 ._availability_statuses_operations import AvailabilityStatusesOperations -from ._operations import Operations -from ._metadata_operations import MetadataOperations -from ._impacted_resources_operations import ImpactedResourcesOperations -from ._security_advisory_impacted_resources_operations import SecurityAdvisoryImpactedResourcesOperations -from ._events_operations import EventsOperations -from ._event_operations import EventOperations -from ._child_availability_statuses_operations import ChildAvailabilityStatusesOperations -from ._child_resources_operations import ChildResourcesOperations -from ._emerging_issues_operations import EmergingIssuesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AvailabilityStatusesOperations", - "Operations", - "MetadataOperations", - "ImpactedResourcesOperations", - "SecurityAdvisoryImpactedResourcesOperations", - "EventsOperations", - "EventOperations", - "ChildAvailabilityStatusesOperations", - "ChildResourcesOperations", - "EmergingIssuesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_availability_statuses_operations.py deleted file mode 100644 index b71ba2185d58..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_availability_statuses_operations.py +++ /dev/null @@ -1,434 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._availability_statuses_operations import ( - build_get_by_resource_request, - build_list_by_resource_group_request, - build_list_by_subscription_id_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the subscription. - - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace_async - async def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists all historical availability transitions and impacting events for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_child_availability_statuses_operations.py deleted file mode 100644 index 227bcc2cb71a..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_child_availability_statuses_operations.py +++ /dev/null @@ -1,230 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._child_availability_statuses_operations import build_get_by_resource_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ChildAvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`child_availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" - } - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the historical availability statuses for a single child resource. Use the nextLink - property in the response to get the next page of availability status. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_child_resources_operations.py deleted file mode 100644 index f5db178c35e5..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_child_resources_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._child_resources_operations import build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ChildResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`child_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityStatus"]: - """Lists the all the children and its current health status for a parent resource. Use the - nextLink property in the response to get the next page of children current health. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support not nested parent resource type: - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_emerging_issues_operations.py deleted file mode 100644 index 2e30ed2d4174..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_emerging_issues_operations.py +++ /dev/null @@ -1,200 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._emerging_issues_operations import build_get_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EmergingIssuesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`emerging_issues` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult"]: - """Lists Azure services' emerging issues. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EmergingIssuesGetResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EmergingIssuesGetResult] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("EmergingIssueListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} - - @distributed_trace_async - async def get( - self, issue_name: Union[str, _models.IssueNameParameter], **kwargs: Any - ) -> _models.EmergingIssuesGetResult: - """Gets Azure services' emerging issues. - - :param issue_name: The name of the emerging issue. "default" Required. - :type issue_name: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.IssueNameParameter - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmergingIssuesGetResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EmergingIssuesGetResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) - - request = build_get_request( - issue_name=issue_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_event_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_event_operations.py deleted file mode 100644 index 896bebec6500..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_event_operations.py +++ /dev/null @@ -1,333 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._event_operations import ( - build_fetch_details_by_subscription_id_and_tracking_id_request, - build_fetch_details_by_tenant_id_and_tracking_id_request, - build_get_by_subscription_id_and_tracking_id_request, - build_get_by_tenant_id_and_tracking_id_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EventOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`event` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get_by_subscription_id_and_tracking_id( - self, - event_tracking_id: str, - filter: Optional[str] = None, - query_start_time: Optional[str] = None, - **kwargs: Any - ) -> _models.Event: - """Service health event in the subscription by event tracking id. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Event] = kwargs.pop("cls", None) - - request = build_get_by_subscription_id_and_tracking_id_request( - event_tracking_id=event_tracking_id, - subscription_id=self._config.subscription_id, - filter=filter, - query_start_time=query_start_time, - api_version=api_version, - template_url=self.get_by_subscription_id_and_tracking_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Event", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_subscription_id_and_tracking_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" - } - - @distributed_trace_async - async def fetch_details_by_subscription_id_and_tracking_id( - self, event_tracking_id: str, **kwargs: Any - ) -> _models.Event: - """Service health event details in the subscription by event tracking id. This can be used to - fetch sensitive properties for Security Advisory events. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Event] = kwargs.pop("cls", None) - - request = build_fetch_details_by_subscription_id_and_tracking_id_request( - event_tracking_id=event_tracking_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.fetch_details_by_subscription_id_and_tracking_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Event", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - fetch_details_by_subscription_id_and_tracking_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" - } - - @distributed_trace_async - async def get_by_tenant_id_and_tracking_id( - self, - event_tracking_id: str, - filter: Optional[str] = None, - query_start_time: Optional[str] = None, - **kwargs: Any - ) -> _models.Event: - """Service health event in the tenant by event tracking id. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Event] = kwargs.pop("cls", None) - - request = build_get_by_tenant_id_and_tracking_id_request( - event_tracking_id=event_tracking_id, - filter=filter, - query_start_time=query_start_time, - api_version=api_version, - template_url=self.get_by_tenant_id_and_tracking_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Event", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_tenant_id_and_tracking_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"} - - @distributed_trace_async - async def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: str, **kwargs: Any) -> _models.Event: - """Service health event details in the tenant by event tracking id. This can be used to fetch - sensitive properties for Security Advisory events. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Event] = kwargs.pop("cls", None) - - request = build_fetch_details_by_tenant_id_and_tracking_id_request( - event_tracking_id=event_tracking_id, - api_version=api_version, - template_url=self.fetch_details_by_tenant_id_and_tracking_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Event", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - fetch_details_by_tenant_id_and_tracking_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" - } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_events_operations.py deleted file mode 100644 index 2beb7f72dbcb..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_events_operations.py +++ /dev/null @@ -1,349 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._events_operations import ( - build_list_by_single_resource_request, - build_list_by_subscription_id_request, - build_list_by_tenant_id_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EventsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`events` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Event"]: - """Lists service health events in the subscription. - - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - query_start_time=query_start_time, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" - } - - @distributed_trace - def list_by_tenant_id( - self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Event"]: - """Lists current service health events in the tenant. - - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_tenant_id_request( - filter=filter, - query_start_time=query_start_time, - api_version=api_version, - template_url=self.list_by_tenant_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_tenant_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events"} - - @distributed_trace - def list_by_single_resource( - self, resource_uri: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Event"]: - """Lists current service health events for given resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_single_resource_request( - resource_uri=resource_uri, - filter=filter, - api_version=api_version, - template_url=self.list_by_single_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_impacted_resources_operations.py deleted file mode 100644 index aea7fa067b56..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_impacted_resources_operations.py +++ /dev/null @@ -1,384 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._impacted_resources_operations import ( - build_get_by_tenant_id_request, - build_get_request, - build_list_by_subscription_id_and_event_id_request, - build_list_by_tenant_id_and_event_id_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ImpactedResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`impacted_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id_and_event_id( - self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.EventImpactedResource"]: - """Lists impacted resources in the subscription by an event. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventImpactedResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_and_event_id_request( - event_tracking_id=event_tracking_id, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list_by_subscription_id_and_event_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription_id_and_event_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" - } - - @distributed_trace_async - async def get( - self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any - ) -> _models.EventImpactedResource: - """Gets the specific impacted resource in the subscription by an event. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param impacted_resource_name: Name of the Impacted Resource. Required. - :type impacted_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EventImpactedResource or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) - - request = build_get_request( - event_tracking_id=event_tracking_id, - impacted_resource_name=impacted_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EventImpactedResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" - } - - @distributed_trace - def list_by_tenant_id_and_event_id( - self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.EventImpactedResource"]: - """Lists impacted resources in the tenant by an event. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventImpactedResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_tenant_id_and_event_id_request( - event_tracking_id=event_tracking_id, - filter=filter, - api_version=api_version, - template_url=self.list_by_tenant_id_and_event_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_tenant_id_and_event_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" - } - - @distributed_trace_async - async def get_by_tenant_id( - self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any - ) -> _models.EventImpactedResource: - """Gets the specific impacted resource in the tenant by an event. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param impacted_resource_name: Name of the Impacted Resource. Required. - :type impacted_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EventImpactedResource or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) - - request = build_get_by_tenant_id_request( - event_tracking_id=event_tracking_id, - impacted_resource_name=impacted_resource_name, - api_version=api_version, - template_url=self.get_by_tenant_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EventImpactedResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_tenant_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" - } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_metadata_operations.py deleted file mode 100644 index 4b0fcc4852fc..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_metadata_operations.py +++ /dev/null @@ -1,196 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._metadata_operations import build_get_entity_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`metadata` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.MetadataEntity"]: - """Gets the list of metadata entities. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MetadataEntity or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.MetadataEntity] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MetadataEntityListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} - - @distributed_trace_async - async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: - """Gets the list of metadata entities. - - :param name: Name of metadata entity. Required. - :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MetadataEntity or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.MetadataEntity - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) - - request = build_get_entity_request( - name=name, - api_version=api_version, - template_url=self.get_entity.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetadataEntity", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_operations.py deleted file mode 100644 index a1929078f254..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,107 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list(self, **kwargs: Any) -> _models.OperationListResult: - """Lists available operations for the resourcehealth resource provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.OperationListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _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("OperationListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_security_advisory_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_security_advisory_impacted_resources_operations.py deleted file mode 100644 index d026ba6d83f1..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/aio/operations/_security_advisory_impacted_resources_operations.py +++ /dev/null @@ -1,250 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._security_advisory_impacted_resources_operations import ( - build_list_by_subscription_id_and_event_id_request, - build_list_by_tenant_id_and_event_id_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SecurityAdvisoryImpactedResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.aio.ResourceHealthMgmtClient`'s - :attr:`security_advisory_impacted_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id_and_event_id( - self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.EventImpactedResource"]: - """Lists impacted resources in the subscription by an event (Security Advisory). - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventImpactedResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_and_event_id_request( - event_tracking_id=event_tracking_id, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list_by_subscription_id_and_event_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription_id_and_event_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" - } - - @distributed_trace - def list_by_tenant_id_and_event_id( - self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.EventImpactedResource"]: - """Lists impacted resources in the tenant by an event (Security Advisory). - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventImpactedResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_tenant_id_and_event_id_request( - event_tracking_id=event_tracking_id, - filter=filter, - api_version=api_version, - template_url=self.list_by_tenant_id_and_event_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_tenant_id_and_event_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" - } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/__init__.py deleted file mode 100644 index 5ef1b5084a40..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/__init__.py +++ /dev/null @@ -1,37 +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 ._availability_statuses_operations import AvailabilityStatusesOperations -from ._operations import Operations -from ._metadata_operations import MetadataOperations -from ._impacted_resources_operations import ImpactedResourcesOperations -from ._security_advisory_impacted_resources_operations import SecurityAdvisoryImpactedResourcesOperations -from ._events_operations import EventsOperations -from ._event_operations import EventOperations -from ._child_availability_statuses_operations import ChildAvailabilityStatusesOperations -from ._child_resources_operations import ChildResourcesOperations -from ._emerging_issues_operations import EmergingIssuesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AvailabilityStatusesOperations", - "Operations", - "MetadataOperations", - "ImpactedResourcesOperations", - "SecurityAdvisoryImpactedResourcesOperations", - "EventsOperations", - "EventOperations", - "ChildAvailabilityStatusesOperations", - "ChildResourcesOperations", - "EmergingIssuesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_availability_statuses_operations.py deleted file mode 100644 index e509f0ce621e..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_availability_statuses_operations.py +++ /dev/null @@ -1,564 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_id_request( - subscription_id: str, *, filter: Optional[str] = None, expand: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "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, - *, - filter: Optional[str] = None, - expand: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_by_resource_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the subscription. - - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the current availability status for all the resources in the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" - } - - @distributed_trace - def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists all historical availability transitions and impacting events for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_child_availability_statuses_operations.py deleted file mode 100644 index ed883d83274b..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_child_availability_statuses_operations.py +++ /dev/null @@ -1,294 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_by_resource_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" - ) - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ChildAvailabilityStatusesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`child_availability_statuses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get_by_resource( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> _models.AvailabilityStatus: - """Gets current availability status for a single resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) - - request = build_get_by_resource_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.get_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilityStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_resource.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" - } - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the historical availability statuses for a single child resource. Use the nextLink - property in the response to get the next page of availability status. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_child_resources_operations.py deleted file mode 100644 index 59fb9487d752..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_child_resources_operations.py +++ /dev/null @@ -1,188 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_uri: str, *, filter: Optional[str] = None, expand: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ChildResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`child_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilityStatus"]: - """Lists the all the children and its current health status for a parent resource. Use the - nextLink property in the response to get the next page of children current health. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API only support not nested parent resource type: - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions - in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.AvailabilityStatus] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_uri=resource_uri, - filter=filter, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_emerging_issues_operations.py deleted file mode 100644 index 486a2fe14c8a..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_emerging_issues_operations.py +++ /dev/null @@ -1,243 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/emergingIssues") - - # 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(issue_name: Union[str, _models.IssueNameParameter], **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}") - path_format_arguments = { - "issueName": _SERIALIZER.url("issue_name", issue_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) - - -class EmergingIssuesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`emerging_issues` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: - """Lists Azure services' emerging issues. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EmergingIssuesGetResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EmergingIssuesGetResult] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("EmergingIssueListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} - - @distributed_trace - def get(self, issue_name: Union[str, _models.IssueNameParameter], **kwargs: Any) -> _models.EmergingIssuesGetResult: - """Gets Azure services' emerging issues. - - :param issue_name: The name of the emerging issue. "default" Required. - :type issue_name: str or - ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.IssueNameParameter - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EmergingIssuesGetResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EmergingIssuesGetResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) - - request = build_get_request( - issue_name=issue_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_event_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_event_operations.py deleted file mode 100644 index 39285c29f6c2..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_event_operations.py +++ /dev/null @@ -1,451 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_by_subscription_id_and_tracking_id_request( - event_tracking_id: str, - subscription_id: str, - *, - filter: Optional[str] = None, - query_start_time: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if query_start_time is not None: - _params["queryStartTime"] = _SERIALIZER.query("query_start_time", query_start_time, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_fetch_details_by_subscription_id_and_tracking_id_request( - event_tracking_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_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_get_by_tenant_id_and_tracking_id_request( - event_tracking_id: str, *, filter: Optional[str] = None, query_start_time: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}") - path_format_arguments = { - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if query_start_time is not None: - _params["queryStartTime"] = _SERIALIZER.query("query_start_time", query_start_time, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_fetch_details_by_tenant_id_and_tracking_id_request(event_tracking_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails") - path_format_arguments = { - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class EventOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`event` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get_by_subscription_id_and_tracking_id( - self, - event_tracking_id: str, - filter: Optional[str] = None, - query_start_time: Optional[str] = None, - **kwargs: Any - ) -> _models.Event: - """Service health event in the subscription by event tracking id. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Event] = kwargs.pop("cls", None) - - request = build_get_by_subscription_id_and_tracking_id_request( - event_tracking_id=event_tracking_id, - subscription_id=self._config.subscription_id, - filter=filter, - query_start_time=query_start_time, - api_version=api_version, - template_url=self.get_by_subscription_id_and_tracking_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Event", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_subscription_id_and_tracking_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" - } - - @distributed_trace - def fetch_details_by_subscription_id_and_tracking_id(self, event_tracking_id: str, **kwargs: Any) -> _models.Event: - """Service health event details in the subscription by event tracking id. This can be used to - fetch sensitive properties for Security Advisory events. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Event] = kwargs.pop("cls", None) - - request = build_fetch_details_by_subscription_id_and_tracking_id_request( - event_tracking_id=event_tracking_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.fetch_details_by_subscription_id_and_tracking_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Event", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - fetch_details_by_subscription_id_and_tracking_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" - } - - @distributed_trace - def get_by_tenant_id_and_tracking_id( - self, - event_tracking_id: str, - filter: Optional[str] = None, - query_start_time: Optional[str] = None, - **kwargs: Any - ) -> _models.Event: - """Service health event in the tenant by event tracking id. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Event] = kwargs.pop("cls", None) - - request = build_get_by_tenant_id_and_tracking_id_request( - event_tracking_id=event_tracking_id, - filter=filter, - query_start_time=query_start_time, - api_version=api_version, - template_url=self.get_by_tenant_id_and_tracking_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Event", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_tenant_id_and_tracking_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"} - - @distributed_trace - def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: str, **kwargs: Any) -> _models.Event: - """Service health event details in the tenant by event tracking id. This can be used to fetch - sensitive properties for Security Advisory events. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Event] = kwargs.pop("cls", None) - - request = build_fetch_details_by_tenant_id_and_tracking_id_request( - event_tracking_id=event_tracking_id, - api_version=api_version, - template_url=self.fetch_details_by_tenant_id_and_tracking_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Event", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - fetch_details_by_tenant_id_and_tracking_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" - } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_events_operations.py deleted file mode 100644 index a9a954bb06ca..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_events_operations.py +++ /dev/null @@ -1,431 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_id_request( - subscription_id: str, *, filter: Optional[str] = None, query_start_time: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if query_start_time is not None: - _params["queryStartTime"] = _SERIALIZER.query("query_start_time", query_start_time, "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_tenant_id_request( - *, filter: Optional[str] = None, query_start_time: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/events") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if query_start_time is not None: - _params["queryStartTime"] = _SERIALIZER.query("query_start_time", query_start_time, "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_single_resource_request( - resource_uri: str, *, filter: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/events") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class EventsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`events` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id( - self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Event"]: - """Lists service health events in the subscription. - - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_request( - subscription_id=self._config.subscription_id, - filter=filter, - query_start_time=query_start_time, - api_version=api_version, - template_url=self.list_by_subscription_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" - } - - @distributed_trace - def list_by_tenant_id( - self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Event"]: - """Lists current service health events in the tenant. - - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :param query_start_time: Specifies from when to return events, based on the lastUpdateTime - property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default - value is None. - :type query_start_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_tenant_id_request( - filter=filter, - query_start_time=query_start_time, - api_version=api_version, - template_url=self.list_by_tenant_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_tenant_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events"} - - @distributed_trace - def list_by_single_resource( - self, resource_uri: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Event"]: - """Lists current service health events for given resource. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Currently the API support not nested and one nesting level resource types : - /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} - and - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. - Required. - :type resource_uri: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.Event] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.Events] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_single_resource_request( - resource_uri=resource_uri, - filter=filter, - api_version=api_version, - template_url=self.list_by_single_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("Events", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_impacted_resources_operations.py deleted file mode 100644 index 3fd88c4ac157..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_impacted_resources_operations.py +++ /dev/null @@ -1,502 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_id_and_event_id_request( - event_tracking_id: str, subscription_id: str, *, filter: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "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( - event_tracking_id: str, impacted_resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), - "impactedResourceName": _SERIALIZER.url( - "impacted_resource_name", impacted_resource_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_list_by_tenant_id_and_event_id_request( - event_tracking_id: str, *, filter: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources") - path_format_arguments = { - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_by_tenant_id_request(event_tracking_id: str, impacted_resource_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), - "impactedResourceName": _SERIALIZER.url( - "impacted_resource_name", impacted_resource_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) - - -class ImpactedResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`impacted_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id_and_event_id( - self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.EventImpactedResource"]: - """Lists impacted resources in the subscription by an event. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventImpactedResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_and_event_id_request( - event_tracking_id=event_tracking_id, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list_by_subscription_id_and_event_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription_id_and_event_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" - } - - @distributed_trace - def get(self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any) -> _models.EventImpactedResource: - """Gets the specific impacted resource in the subscription by an event. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param impacted_resource_name: Name of the Impacted Resource. Required. - :type impacted_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EventImpactedResource or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) - - request = build_get_request( - event_tracking_id=event_tracking_id, - impacted_resource_name=impacted_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EventImpactedResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" - } - - @distributed_trace - def list_by_tenant_id_and_event_id( - self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.EventImpactedResource"]: - """Lists impacted resources in the tenant by an event. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventImpactedResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_tenant_id_and_event_id_request( - event_tracking_id=event_tracking_id, - filter=filter, - api_version=api_version, - template_url=self.list_by_tenant_id_and_event_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_tenant_id_and_event_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" - } - - @distributed_trace - def get_by_tenant_id( - self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any - ) -> _models.EventImpactedResource: - """Gets the specific impacted resource in the tenant by an event. - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param impacted_resource_name: Name of the Impacted Resource. Required. - :type impacted_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EventImpactedResource or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) - - request = build_get_by_tenant_id_request( - event_tracking_id=event_tracking_id, - impacted_resource_name=impacted_resource_name, - api_version=api_version, - template_url=self.get_by_tenant_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EventImpactedResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_tenant_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" - } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_metadata_operations.py deleted file mode 100644 index 1fea23941f7e..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_metadata_operations.py +++ /dev/null @@ -1,241 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/metadata") - - # 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_entity_request(name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/metadata/{name}") - path_format_arguments = { - "name": _SERIALIZER.url("name", 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) - - -class MetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`metadata` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.MetadataEntity"]: - """Gets the list of metadata entities. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MetadataEntity or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.MetadataEntity] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MetadataEntityListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} - - @distributed_trace - def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: - """Gets the list of metadata entities. - - :param name: Name of metadata entity. Required. - :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MetadataEntity or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.MetadataEntity - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) - - request = build_get_entity_request( - name=name, - api_version=api_version, - template_url=self.get_entity.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetadataEntity", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_operations.py deleted file mode 100644 index f36991c23047..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_operations.py +++ /dev/null @@ -1,129 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> _models.OperationListResult: - """Lists available operations for the resourcehealth resource provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.resourcehealth.v2023_10_01_preview.models.OperationListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _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("OperationListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_security_advisory_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_security_advisory_impacted_resources_operations.py deleted file mode 100644 index 4ab4534b638f..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/operations/_security_advisory_impacted_resources_operations.py +++ /dev/null @@ -1,313 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_id_and_event_id_request( - event_tracking_id: str, subscription_id: str, *, filter: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_tenant_id_and_event_id_request( - event_tracking_id: str, *, filter: 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", "2023-10-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources", - ) # pylint: disable=line-too-long - path_format_arguments = { - "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class SecurityAdvisoryImpactedResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2023_10_01_preview.ResourceHealthMgmtClient`'s - :attr:`security_advisory_impacted_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription_id_and_event_id( - self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.EventImpactedResource"]: - """Lists impacted resources in the subscription by an event (Security Advisory). - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventImpactedResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_id_and_event_id_request( - event_tracking_id=event_tracking_id, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list_by_subscription_id_and_event_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription_id_and_event_id.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" - } - - @distributed_trace - def list_by_tenant_id_and_event_id( - self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.EventImpactedResource"]: - """Lists impacted resources in the tenant by an event (Security Advisory). - - :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. - :type event_tracking_id: str - :param filter: The filter to apply on the operation. For more information please see - https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value - is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventImpactedResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2023_10_01_preview.models.EventImpactedResource] - :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._api_version or "2023-10-01-preview") - ) - cls: ClsType[_models.EventImpactedResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_tenant_id_and_event_id_request( - event_tracking_id=event_tracking_id, - filter=filter, - api_version=api_version, - template_url=self.list_by_tenant_id_and_event_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("EventImpactedResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_tenant_id_and_event_id.metadata = { - "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" - } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/py.typed b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2023_10_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py index 060ece11cd85..c82dacea80dd 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/AvailabilityStatus_GetByResource.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py index 6e628013cc21..388229cd0778 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_List.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/AvailabilityStatuses_List.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py index f907ef544ed2..a37bc4259b6c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/AvailabilityStatuses_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py index 905f30275f84..8d924abd3c67 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/AvailabilityStatuses_ListBySubscriptionId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_status_get_by_resource.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_status_get_by_resource.py index 6884d75546e5..b83288abd2d0 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_status_get_by_resource.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_status_get_by_resource.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ChildAvailabilityStatus_GetByResource.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_statuses_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_statuses_list.py index add2314fa3da..2f5a130a0893 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_statuses_list.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_statuses_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ChildAvailabilityStatuses_List.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_resources_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_resources_list.py index 81d9bb4f894a..c1eaadc137f4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_resources_list.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_resources_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ChildResources_List.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py index 8843d5dfc561..33eb9040ed00 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/EmergingIssues_Get.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py index 4118e3a4c788..eb8b12506863 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/EmergingIssues_List.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_subscription_id_and_tracking_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_subscription_id_and_tracking_id.py index 5efff406fa4d..dfe60482d1b0 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_subscription_id_and_tracking_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_subscription_id_and_tracking_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_tenant_id_and_tracking_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_tenant_id_and_tracking_id.py index cbe49e95e720..e679db8a8c1f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_tenant_id_and_tracking_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_tenant_id_and_tracking_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_fetchDetailsByTenantIdAndTrackingId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_subscription_id_and_tracking_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_subscription_id_and_tracking_id.py index c2fce01bd69c..5f8c43ce7327 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_subscription_id_and_tracking_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_subscription_id_and_tracking_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_tenant_id_and_tracking_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_tenant_id_and_tracking_id.py index 280e71177e55..37268a6b4e9e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_tenant_id_and_tracking_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_tenant_id_and_tracking_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py index 8f71a82bc399..6793dc8acb60 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Events_ListBySingleResource.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py index cc3f33929be3..45664a42e823 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Events_ListBySubscriptionId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_tenant_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_tenant_id.py index 6db93d535f47..2148ed6af844 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_tenant_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_tenant_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Events_ListByTenantId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get.py index f545a642cd87..13a3ed716441 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_Get.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get_by_tenant_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get_by_tenant_id.py index 3b6775d59c98..6a83de38c4c2 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get_by_tenant_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get_by_tenant_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_GetByTenantId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_subscription_id_list_by_event_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_subscription_id_list_by_event_id.py index f1a6b6732bba..bc13e833e332 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_subscription_id_list_by_event_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_subscription_id_list_by_event_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_tenant_id_list_by_event_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_tenant_id_list_by_event_id.py index b68ae5f56bc1..9b3c6d5531f4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_tenant_id_list_by_event_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_tenant_id_list_by_event_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_ListByTenantId_ListByEventId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py index d8a91fa56540..dfe0062c42c5 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Metadata_GetEntity.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py index 42685da8b418..31d0d021b73e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Metadata_List.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/operations_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/operations_list.py index 0a9a7c892324..1e9c8a9ad2b1 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/operations_list.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/operations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -33,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Operations_List.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_subscription_id_list_by_event_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_subscription_id_list_by_event_id.py index a89b53135f84..ff9fc7326cf2 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_subscription_id_list_by_event_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_subscription_id_list_by_event_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_tenant_id_list_by_event_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_tenant_id_list_by_event_id.py index a12174028160..fd168f737f01 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_tenant_id_list_by_event_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_tenant_id_list_by_event_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/conftest.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/conftest.py new file mode 100644 index 000000000000..629c676b3e8d --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + resourcehealthmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + resourcehealthmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + resourcehealthmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + resourcehealthmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=resourcehealthmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=resourcehealthmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=resourcehealthmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=resourcehealthmgmt_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_availability_statuses_operations.py new file mode 100644 index 000000000000..2a31b3241ac3 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_availability_statuses_operations.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtAvailabilityStatusesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription_id(self, resource_group): + response = self.client.availability_statuses.list_by_subscription_id( + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.availability_statuses.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_resource(self, resource_group): + response = self.client.availability_statuses.get_by_resource( + resource_uri="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.availability_statuses.list( + resource_uri="str", + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_availability_statuses_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_availability_statuses_operations_async.py new file mode 100644 index 000000000000..218e74987841 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_availability_statuses_operations_async.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtAvailabilityStatusesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription_id(self, resource_group): + response = self.client.availability_statuses.list_by_subscription_id( + api_version="2023-10-01-preview", + ) + 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_list_by_resource_group(self, resource_group): + response = self.client.availability_statuses.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-10-01-preview", + ) + 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_get_by_resource(self, resource_group): + response = await self.client.availability_statuses.get_by_resource( + resource_uri="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.availability_statuses.list( + resource_uri="str", + api_version="2023-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_availability_statuses_operations.py new file mode 100644 index 000000000000..46d69229bbca --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_availability_statuses_operations.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtChildAvailabilityStatusesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_resource(self, resource_group): + response = self.client.child_availability_statuses.get_by_resource( + resource_uri="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.child_availability_statuses.list( + resource_uri="str", + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_availability_statuses_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_availability_statuses_operations_async.py new file mode 100644 index 000000000000..6b19d0f90eae --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_availability_statuses_operations_async.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtChildAvailabilityStatusesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_by_resource(self, resource_group): + response = await self.client.child_availability_statuses.get_by_resource( + resource_uri="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.child_availability_statuses.list( + resource_uri="str", + api_version="2023-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_resources_operations.py new file mode 100644 index 000000000000..70c9193daf16 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_resources_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtChildResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.child_resources.list( + resource_uri="str", + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_resources_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_resources_operations_async.py new file mode 100644 index 000000000000..f7e8e1a41919 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_child_resources_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtChildResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.child_resources.list( + resource_uri="str", + api_version="2023-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_emerging_issues_operations.py new file mode 100644 index 000000000000..807f2172d394 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_emerging_issues_operations.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtEmergingIssuesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.emerging_issues.list( + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.emerging_issues.get( + issue_name="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_emerging_issues_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_emerging_issues_operations_async.py new file mode 100644 index 000000000000..fdb0bf9cc710 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_emerging_issues_operations_async.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtEmergingIssuesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.emerging_issues.list( + api_version="2023-10-01-preview", + ) + 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_get(self, resource_group): + response = await self.client.emerging_issues.get( + issue_name="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_event_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_event_operations.py new file mode 100644 index 000000000000..ccbda0c273b3 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_event_operations.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtEventOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_subscription_id_and_tracking_id(self, resource_group): + response = self.client.event.get_by_subscription_id_and_tracking_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fetch_details_by_subscription_id_and_tracking_id(self, resource_group): + response = self.client.event.fetch_details_by_subscription_id_and_tracking_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_tenant_id_and_tracking_id(self, resource_group): + response = self.client.event.get_by_tenant_id_and_tracking_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fetch_details_by_tenant_id_and_tracking_id(self, resource_group): + response = self.client.event.fetch_details_by_tenant_id_and_tracking_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_event_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_event_operations_async.py new file mode 100644 index 000000000000..62c89e1ab676 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_event_operations_async.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtEventOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_by_subscription_id_and_tracking_id(self, resource_group): + response = await self.client.event.get_by_subscription_id_and_tracking_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fetch_details_by_subscription_id_and_tracking_id(self, resource_group): + response = await self.client.event.fetch_details_by_subscription_id_and_tracking_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_by_tenant_id_and_tracking_id(self, resource_group): + response = await self.client.event.get_by_tenant_id_and_tracking_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fetch_details_by_tenant_id_and_tracking_id(self, resource_group): + response = await self.client.event.fetch_details_by_tenant_id_and_tracking_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_events_operations.py new file mode 100644 index 000000000000..0b66a5b0b566 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_events_operations.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtEventsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription_id(self, resource_group): + response = self.client.events.list_by_subscription_id( + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_tenant_id(self, resource_group): + response = self.client.events.list_by_tenant_id( + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_single_resource(self, resource_group): + response = self.client.events.list_by_single_resource( + resource_uri="str", + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_events_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_events_operations_async.py new file mode 100644 index 000000000000..d0f56b0002d5 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_events_operations_async.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtEventsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription_id(self, resource_group): + response = self.client.events.list_by_subscription_id( + api_version="2023-10-01-preview", + ) + 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_list_by_tenant_id(self, resource_group): + response = self.client.events.list_by_tenant_id( + api_version="2023-10-01-preview", + ) + 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_list_by_single_resource(self, resource_group): + response = self.client.events.list_by_single_resource( + resource_uri="str", + api_version="2023-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_impacted_resources_operations.py new file mode 100644 index 000000000000..3c548390a30c --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_impacted_resources_operations.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtImpactedResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription_id_and_event_id(self, resource_group): + response = self.client.impacted_resources.list_by_subscription_id_and_event_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.impacted_resources.get( + event_tracking_id="str", + impacted_resource_name="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_tenant_id_and_event_id(self, resource_group): + response = self.client.impacted_resources.list_by_tenant_id_and_event_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_tenant_id(self, resource_group): + response = self.client.impacted_resources.get_by_tenant_id( + event_tracking_id="str", + impacted_resource_name="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_impacted_resources_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_impacted_resources_operations_async.py new file mode 100644 index 000000000000..26a59de54816 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_impacted_resources_operations_async.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtImpactedResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription_id_and_event_id(self, resource_group): + response = self.client.impacted_resources.list_by_subscription_id_and_event_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + 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_get(self, resource_group): + response = await self.client.impacted_resources.get( + event_tracking_id="str", + impacted_resource_name="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_tenant_id_and_event_id(self, resource_group): + response = self.client.impacted_resources.list_by_tenant_id_and_event_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + 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_get_by_tenant_id(self, resource_group): + response = await self.client.impacted_resources.get_by_tenant_id( + event_tracking_id="str", + impacted_resource_name="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_metadata_operations.py new file mode 100644 index 000000000000..7556d047f493 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_metadata_operations.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtMetadataOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.metadata.list( + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_entity(self, resource_group): + response = self.client.metadata.get_entity( + name="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_metadata_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_metadata_operations_async.py new file mode 100644 index 000000000000..46429578ecec --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_metadata_operations_async.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtMetadataOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.metadata.list( + api_version="2023-10-01-preview", + ) + 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_get_entity(self, resource_group): + response = await self.client.metadata.get_entity( + name="str", + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_operations.py new file mode 100644 index 000000000000..301fe4508ae3 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_operations_async.py new file mode 100644 index 000000000000..d8c20d44264c --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.operations.list( + api_version="2023-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_security_advisory_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_security_advisory_impacted_resources_operations.py new file mode 100644 index 000000000000..daa6e55fc751 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_security_advisory_impacted_resources_operations.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtSecurityAdvisoryImpactedResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription_id_and_event_id(self, resource_group): + response = self.client.security_advisory_impacted_resources.list_by_subscription_id_and_event_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_tenant_id_and_event_id(self, resource_group): + response = self.client.security_advisory_impacted_resources.list_by_tenant_id_and_event_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_security_advisory_impacted_resources_operations_async.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_security_advisory_impacted_resources_operations_async.py new file mode 100644 index 000000000000..d1d5099806cf --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_tests/test_resource_health_mgmt_security_advisory_impacted_resources_operations_async.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestResourceHealthMgmtSecurityAdvisoryImpactedResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription_id_and_event_id(self, resource_group): + response = self.client.security_advisory_impacted_resources.list_by_subscription_id_and_event_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + 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_list_by_tenant_id_and_event_id(self, resource_group): + response = self.client.security_advisory_impacted_resources.list_by_tenant_id_and_event_id( + event_tracking_id="str", + api_version="2023-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/setup.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/setup.py index 487f6ea32970..3b6dca12db37 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/setup.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,10 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", ) From f55670e8293f003ecd89c7eab6eff94fbbfa299c Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Wed, 30 Oct 2024 14:37:36 +0800 Subject: [PATCH 2/4] update-testcase --- .../azure-mgmt-resourcehealth/CHANGELOG.md | 4 ++- .../azure-mgmt-resourcehealth/_meta.json | 4 --- .../azure/mgmt/resourcehealth/_version.py | 2 +- .../dev_requirements.txt | 2 ++ .../azure-mgmt-resourcehealth/setup.py | 8 +++-- .../tests/conftest.py | 35 ++++++++++++++++++ ...lability_statuses_operations_async_test.py | 36 +++++++++++++++++++ ...t_availability_statuses_operations_test.py | 35 ++++++++++++++++++ ...ealth_mgmt_events_operations_async_test.py | 27 ++++++++++++++ ...urce_health_mgmt_events_operations_test.py | 26 ++++++++++++++ ...lth_mgmt_metadata_operations_async_test.py | 27 ++++++++++++++ ...ce_health_mgmt_metadata_operations_test.py | 26 ++++++++++++++ ...ource_health_mgmt_operations_async_test.py | 27 ++++++++++++++ ...st_resource_health_mgmt_operations_test.py | 26 ++++++++++++++ 14 files changed, 276 insertions(+), 9 deletions(-) create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/conftest.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_availability_statuses_operations_async_test.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_availability_statuses_operations_test.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_events_operations_async_test.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_events_operations_test.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_metadata_operations_async_test.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_metadata_operations_test.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_operations_async_test.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_operations_test.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md b/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md index b39a6e30a1a5..0ea1263eeac4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md @@ -1,8 +1,10 @@ # Release History -## 0.0.0(it should be perview) (2024-10-30) +## 1.0.0b6 (2024-10-30) +### Breaking Changes + - This package now only targets the latest Api-Version available on Azure and removes APIs of other Api-Version. After this change, the package can have much smaller size. If your application requires a specific and non-latest Api-Version, it's recommended to pin this package to the previous released version; If your application always only use latest Api-Version, please ingore this change. ## 1.0.0b5 (2023-10-23) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json index 4a30a4030ee3..ca4a6199971e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json @@ -8,8 +8,4 @@ ], "autorest_command": "autorest specification/resourcehealth/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-preview-2023-10 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/resourcehealth/resource-manager/readme.md", - "package-preview-2023-10": "2023-10-09 01:38:27 -0700 d9f13b4f513be56ca9bb14e97f8a699ac9a5a1cc Microsoft.ResourceHealth/preview/2023-10-01-preview/ResourceHealth.json", - "package-2022-10": "2023-03-30 22:08:54 -0700 635b756c218c138de49cf3f4a3204e75630fc300 Microsoft.ResourceHealth/stable/2022-10-01/ResourceHealth.json", - "package-2018-07-01": "2023-03-29 21:56:50 -0700 f0e86b9b4ab51cddbc451c9ead25781b552342f0 Microsoft.ResourceHealth/stable/2018-07-01/ResourceHealth.json", - "package-2015-01": "2023-03-29 21:56:50 -0700 f0e86b9b4ab51cddbc451c9ead25781b552342f0 Microsoft.ResourceHealth/stable/2015-01-01/resourcehealth.json" } \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py index 9bd4c9b55137..28e175fcb7b7 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.0.0" +VERSION = "1.0.0b6" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/dev_requirements.txt b/sdk/resourcehealth/azure-mgmt-resourcehealth/dev_requirements.txt index 6ccb7f031ddd..8bf78f8c9ae8 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/dev_requirements.txt +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/dev_requirements.txt @@ -1 +1,3 @@ -e ../../../tools/azure-sdk-tools +-e ../../resources/azure-mgmt-resource +aiohttp diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/setup.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/setup.py index 3b6dca12db37..35c8d7c13ab1 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/setup.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/setup.py @@ -22,9 +22,11 @@ # Version extraction inspired from 'requests' with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), + ( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py") + ), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/conftest.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/conftest.py new file mode 100644 index 000000000000..629c676b3e8d --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + resourcehealthmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + resourcehealthmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + resourcehealthmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + resourcehealthmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=resourcehealthmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=resourcehealthmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=resourcehealthmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=resourcehealthmgmt_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_availability_statuses_operations_async_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_availability_statuses_operations_async_test.py new file mode 100644 index 000000000000..6b93383c80fd --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_availability_statuses_operations_async_test.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtAvailabilityStatusesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription_id(self, resource_group): + response = self.client.availability_statuses.list_by_subscription_id() + result = [r async for r in response] + assert response + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.availability_statuses.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + assert result == [] diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_availability_statuses_operations_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_availability_statuses_operations_test.py new file mode 100644 index 000000000000..848cb94112ba --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_availability_statuses_operations_test.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtAvailabilityStatusesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription_id(self, resource_group): + response = self.client.availability_statuses.list_by_subscription_id() + result = [r for r in response] + assert response + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.availability_statuses.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + assert result == [] diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_events_operations_async_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_events_operations_async_test.py new file mode 100644 index 000000000000..d7db52c533a9 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_events_operations_async_test.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtEventsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription_id(self, resource_group): + response = self.client.events.list_by_subscription_id() + result = [r async for r in response] + assert response diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_events_operations_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_events_operations_test.py new file mode 100644 index 000000000000..b1cf41c254a1 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_events_operations_test.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtEventsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription_id(self, resource_group): + response = self.client.events.list_by_subscription_id() + result = [r for r in response] + assert response diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_metadata_operations_async_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_metadata_operations_async_test.py new file mode 100644 index 000000000000..f5fa18180834 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_metadata_operations_async_test.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtMetadataOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.metadata.list() + result = [r async for r in response] + assert response diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_metadata_operations_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_metadata_operations_test.py new file mode 100644 index 000000000000..b86ffb4bde52 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_metadata_operations_test.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtMetadataOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.metadata.list() + result = [r for r in response] + assert response diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_operations_async_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_operations_async_test.py new file mode 100644 index 000000000000..a22ae1c116e3 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_operations_async_test.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.operations.list() + + assert response.value diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_operations_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_operations_test.py new file mode 100644 index 000000000000..e9305542ff2e --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_operations_test.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list() + + assert response.value From b8884dd8cd846d21bd0e9a593f9ae098440896ff Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Wed, 30 Oct 2024 14:53:40 +0800 Subject: [PATCH 3/4] update-testcases --- ...t_emerging_issues_operations_async_test.py | 28 +++++++++++++++++++ ...th_mgmt_emerging_issues_operations_test.py | 27 ++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_async_test.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_test.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_async_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_async_test.py new file mode 100644 index 000000000000..5b3fe61142ba --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_async_test.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth.aio import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtEmergingIssuesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.emerging_issues.list() + result = [r async for r in response] + assert response + \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_test.py new file mode 100644 index 000000000000..6844af0c5815 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_test.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestResourceHealthMgmtEmergingIssuesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ResourceHealthMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.emerging_issues.list() + result = [r for r in response] + assert response + \ No newline at end of file From 002f651f1a69c6a75e744dc5167f5bb12471102e Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Wed, 30 Oct 2024 14:54:49 +0800 Subject: [PATCH 4/4] update-testcases --- ...resource_health_mgmt_emerging_issues_operations_async_test.py | 1 - .../test_resource_health_mgmt_emerging_issues_operations_test.py | 1 - 2 files changed, 2 deletions(-) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_async_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_async_test.py index 5b3fe61142ba..19731e1e8c0d 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_async_test.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_async_test.py @@ -25,4 +25,3 @@ async def test_list(self, resource_group): response = self.client.emerging_issues.list() result = [r async for r in response] assert response - \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_test.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_test.py index 6844af0c5815..8f549abc674c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_test.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/tests/test_resource_health_mgmt_emerging_issues_operations_test.py @@ -24,4 +24,3 @@ def test_list(self, resource_group): response = self.client.emerging_issues.list() result = [r for r in response] assert response - \ No newline at end of file